• Resolved SN0WKRASH

    (@sn0wkrash)


    Hello,

    I was using CPT-onomies for one thing, a custom post type, and it worked perfectly for months. I just built a redesign and launched it last week. When I did this, I created a new category that I put all of these custom post type posts into. I also added the post type to the main query like so:

    function add_ask_us_to_query( $query ) {
    	if ( (is_home() || is_front_page() || is_category() || is_archive()) && !is_admin() && $query->is_main_query() )
    		$query->set( 'post_type', array( 'post', 'ask_us_anything' ) );
    	return $query;
    }
    
    add_action( 'pre_get_posts', 'add_ask_us_to_query' );

    I also added a rewrite rule in the CPT-onomies post settings screen, and was sure it was different from the category I made with a similar name. I downloaded Rewrite Rules Inspector and it shows no errors.

    I made a custom single-(mycustompost).php and that all seems to be working just fine.

    However, when I did these things, I went into the custom post type admin area, and I get the listing of posts that are my custom post type, and I select one, and get the editing screen – if I try to save a modification or I try to even preview the changes, it spins and spins trying to retrieve the page then finally gives me a 502 Bad Gateway error.

    I’ve spent hours troubleshooting and have only contacted you as a last resort. Any ideas? Thank you for taking the time to check out my problem, in advance.

    http://www.ablogtowatch.com – it’s the Ask item in the main nav that brings up the category with the custom post type, ask_us_anything listing. No problems on the front-end.

    http://wordpress.org/plugins/cpt-onomies/

Viewing 6 replies - 1 through 6 (of 6 total)
  • It sounds like you might have a PHP error somewhere in the new code introduced in your updates. This will be hard to debug, but I’d try deactivating plugins one at a time until the error goes away.

    Thread Starter SN0WKRASH

    (@sn0wkrash)

    I’ve deactivated all plugins, even Jetpack, and I still cannot save or preview the custom post type.

    Any ideas beyond a php error? There were no errors in my logs before or after deactivating plugins. Would re-naming the custom displays on the front-end cause problems on the backend like this? I’ve renamed according to what WordPress says to do and it works on the front-end but that’s when the back-end started not to save… think about it – when you go to preview a page, it looks for what the page name it thinks it should be exists, so if it can’t find it, wouldn’t it behave this way? If that’s it, then what should the pages be named if not what WordPress templating dictates?

    Well, if the front end is working just fine and the back end is working up to the point when you’re trying to save edits to a post, then it’s most likely that there is bad code somewhere in the code/functions that are only run when a post is trying to be saved.

    Do you have have any ‘save_post’ filters?

    Thread Starter SN0WKRASH

    (@sn0wkrash)

    Thanks for responding quickly.

    No, I do not know how to do anything with custom post types beyond what I have laid out here. It happens when I try to preview a post, as well – not trying to save it.

    I am also seeing this error a lot in the error logs, and after some research, it turns out this happens when either the custom post type is getting registered incorrectly or when a post type that does not exist is being called or queried:

    [Mon Feb 03 09:51:54 2014] [error] [client 157.55.34.29] PHP Warning: Illegal offset type in isset or empty in /nas/wp/www/cluster-1816/ablogtowatch/wp-includes/post.php on line 1060

    I found something online that looks similar to this:

    http://wordpress.stackexchange.com/questions/19000/illegal-offset-type-in-get-post-type-object?answertab=active#tab-top

    It’s saying that a post type is being referred to that doesn’t exist, basically, so wondering how that could be happening.

    Any ideas?

    Thank you, Kristin

    Thread Starter SN0WKRASH

    (@sn0wkrash)

    Guess what? After hitting my head against a wall for almost a month I found the answer.

    In “Advanced Options” on the settings screen, I unchecked “Revisions” in the “Supports” area. Why would supporting revisions completely disable saving or previewing the post????

    It might be a bug with another plugin you’re using or with WordPress.

    I’m glad you found a quick solution. If you figure out it’s a CPT-onomies issue, please let me know. Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Cannot save or preview custom post type in admin’ is closed to new replies.