WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Looking at custom post type as author produces Warning: Illegal offset (2 posts)

  1. c0nc3pt.SF
    Member
    Posted 2 years ago #

    Greetings all. As an editor and above, I have no issues viewing custom post types. As an author through, if I go to post or the custom post type I see the following error:

    Warning: Illegal offset type in isset or empty in /wp-includes/post.php on line 825

    Below that are all of the authors posts for the regular post type. Having a really tough time figuring this one out. I thought it possibly might be a problem with something I have in one of the arrays under the register_post_type function, but was unable to pin point my problem. Here is the custom post type:

    function post_type_review() {
    	register_post_type('review', array(
    		'label' => __('Reviews'),
    		'singular_label' => __('Review'),
    		'public' => true,
    		'publicly_queryable' => true,
    		'show_ui' => true,
    		'show_in_menu' => true,
    		'menu_position' => 5,
    		'capability_type' => 'post',
    		'supports' => array('title','editor','thumbnail','excerpt','author','trackbacks', 'comments','revisions'),
    		'query_var' => 'review',
    		'taxonomies' => array('post_tag','category','review_type','tweet_tags'),
    		'rewrite' => array("slug" => "review")
    	));
    }
    add_action('init', 'post_type_review');

    Any ideas?

  2. c0nc3pt.SF
    Member
    Posted 2 years ago #

    For those who find this post because you're having the same problem, check your functions.php in your theme to see if you're using any pre_get_posts filters. If so, disable them until you find the one thats causing the error and troubleshoot from there. In my case the problem was the array I was using to filter the multiple post_types. Obviously the if statement on like 825 doesn't like that.

Topic Closed

This topic has been closed to new replies.

About this Topic