• Resolved pconsti

    (@pconsti)


    I don’t know in which versions this happens, but on my site it seems the first normal post (post_type post) gets confused as a custom post (other post_type).

    Always the first one tough. I delete one or put it in the bin, the next one is displayed as custom post (in the archive). Even the permalink is wrong, meaning clicking on the post will be a non-existant link…

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Very odd

    What post types have you registered with CPTUI?

    Thread Starter pconsti

    (@pconsti)

    I just normally created a post type and put some taxonomies in there.

    I am not sure, but I don’t think it’s been like this from the beginning.

    Very strange indeed…

     
     

    Could it be because I once tried copying all posts into a new taxonomy but then decided to delete this taxonomy and use the normal posts again? (There is this option to copy all posts into the new taxonomy, I clicked that..)

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Maybe. I don’t have any sort of access to the database, so I can’t say for sure exactly what existing posts you have in the table, regardless of their post type.

    It’s definitely going to be something specific to your install in my opinion, as I haven’t seen anyone else chime in with any similar issues. We also don’t automatically create any sort of content for you after creating a post type or taxonomy type.

    Thread Starter pconsti

    (@pconsti)

    Seems like it. I just checked the database, the post is categorized as “post” (column post_type). However the query returns my custom type.

    I cannot seem to find the post types in the database, where are they located?

    • This reply was modified 8 years, 9 months ago by pconsti.
    • This reply was modified 8 years, 9 months ago by pconsti.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    There’s nowhere in the database that stores all the intended post types for a given site. They’re all handled at run-time. CPTUI itself stores all of our settings in the wp_options table, but that row doesn’t handle the actual registration. The registration happens later.

    Sounds like the query may be getting affected somewhere along the way by code in the theme or maybe a plugin. Possibly a callback on the pre_get_posts hook.

    Thread Starter pconsti

    (@pconsti)

    Thanks, I’ll be checking that once I got time.

    Great help!

    Thread Starter pconsti

    (@pconsti)

    I have traced the $wp_query a little and there seems to be some real weird problem…

    I used the SQL-Request in my database and I got that ID correctly. Next I tried print_r() with that ID and everything was perfectly fine.

    However, in the loop the $wp_query and the $post display the wrong post_type. And I don’t find any more pre_get_post‘s.

    EDIT: I have narrowed it down to the header. Before get_header() it’s correct, but after, wrong post_type.

    • This reply was modified 8 years, 9 months ago by pconsti.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Worth cracking open your header.php file and see what all is going on in there. Nice sleuthing skills as well.

    Thread Starter pconsti

    (@pconsti)

    I traced it back to a $postI coded in the sidebar…

    I don’t know how that should do anything but it works by rebuilding the query afterwards.

    Thanks! Great plugin by the way!

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    So many tricky details, but glad to see you got it worked out.

    Thanks for the kind words as well 😀

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

The topic ‘Post Type Confusion’ is closed to new replies.