Title: WP 6.5 evaluating function
Last modified: April 4, 2024

---

# WP 6.5 evaluating function

 *  Resolved [musicman847](https://wordpress.org/support/users/musicman847/)
 * (@musicman847)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/wp-6-5-evaluating-function/)
 * HI there – In previous WP versions, the code block that follows returned the 
   content of a post with my slight customizations when using the shortcode within
   a post or template. I have several similar functions that I use, but this is 
   the simplest to share for sake of the example.
 *     ```wp-block-code
       function generate_custom_post($customtext) {
       global $post;
       if ( '' == $customtext ) {
       $customtext = get_the_content('');
       $customtext = apply_filters('the_content', $customtext);
       }
       return $customtext;
       }
   
       add_shortcode( 'custom_post', 'generate_custom_post' );
       ```
   
 *  In WP 6.5, when using the shortcode within a post it simply returns the string“
   Array”. I have disabled all plugins and activated the default theme and the problem
   persists. Is there something about the way 6.5 would evaluate this that’s different?
   Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/wp-6-5-evaluating-function/#post-17550649)
 * The reason is an adjustment to shortcode_parse_atts() in WordPress 6.5. There
   is a ticket here:
   [https://core.trac.wordpress.org/ticket/59249](https://core.trac.wordpress.org/ticket/59249)
 * And here is the dev note for all developers: [https://make.wordpress.org/core/2024/03/08/miscellaneous-developer-changes-in-wordpress-6-5/#shortcodes](https://make.wordpress.org/core/2024/03/08/miscellaneous-developer-changes-in-wordpress-6-5/#shortcodes)
 * The solution in your case is to set to empty() rather than doing a string comparison.
   This will also work in older WordPress versions. I would therefore write it like
   this:
 *     ```wp-block-code
       function generate_custom_post( $custom_text ) {
        if ( empty( $custom_text ) ) {
         return apply_filters('the_content', get_the_content(''));
        }
        return $custom_text;
       }
       add_shortcode( 'custom_post', 'generate_custom_post' );
       ```
   
 *  Thread Starter [musicman847](https://wordpress.org/support/users/musicman847/)
 * (@musicman847)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/wp-6-5-evaluating-function/#post-17551581)
 * Works perfectly. Thank you so much for solving this issue for me. Very much appreciate
   your help 🙂
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/wp-6-5-evaluating-function/#post-17551871)
 * Nice if I could help. You are welcome to set the topic to solved.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘WP 6.5 evaluating function’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [threadi](https://wordpress.org/support/users/threadi/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/wp-6-5-evaluating-function/#post-17551871)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
