ERROR: Only variable references should be returned by reference in wp-includes/post.php

I keep getting this error when I put PHP error reporting on in my WordPress setup.

Notice: Only variable references should be returned by reference in /Users/admin/Sites/wp-includes/post.php on line 3394

Read More

I have a feeling it has to do with the taxonomies and their hierarchal setup.

Been trying to track it down for a while now in the plugin I’m writing.

These are the actual lines of code in the WP Core, the return being on the excact line.

 // Make sure the post type is hierarchical
 $hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) );
 if ( !in_array( $post_type, $hierarchical_post_types ) )
      return false;

I’ll keep debugging it till I find the issue, but any input would be great seeing that i’ve not tracked down the issue in my plugin.

Related posts

Leave a Reply

1 comment

  1. return false; – that’s not a variable
    Try something like

    if ( !in_array( $post_type, $hierarchical_post_types ) ) {
          $rv = false;
          return $rv;
    }
    

    (side-note: I have no idea what wordpress and/or a mod you’re using there is doing, but maybe/probably “return by reference” is a) unnecessary in the first place and b) a relict from a php4 implementation)