Custom post type, when type non existing post name, it query the nearest possible post name by default. How can I disabled this behavior

Out of the box, WordPress will try to be helpful and provide the next best post if it cannot find the one you specified – in your case example/t. This feature can be deactivated, however: function stop_404_guessing( $url ) { return ( is_404() ) ? false : $url; } add_filter( ‘redirect_canonical’, ‘stop_404_guessing’ );

Custom Post Type, 404 error

I solved by eliminating the following portion of code: I don’t remember why I had to code it, it apparently solved an issue, even if I don’t remember what issue. The portion is the following: add_action(‘pre_get_posts’, function ($query) { if (!is_admin() && $query->is_main_query() && empty($query->query_vars[‘suppress_filters’])) { if (is_archive()) { if (is_category()) { $query->set(‘post_type’, [‘post’, ‘docs’]); … Read more

Admin panel search doesn’t work for a specific custom post type

When I register multiple custom post types on the init hook, I don’t use multiple add_action functions. Consider this: function m_register_custom_posts() { register_bolumpost(); register_mangapost(); } add_action(‘init’,’m_register_custom_posts’); I would also add all your custom taxonomy function calls into this function since they fire on the same init hook. You have a lot of custom functions firing … Read more

CPT – Can’t delete Draft posts

I managed to fix it. First I tried to disable plugins but that did not help. The issue was found in functions.php. It had a function inside that does not allow an article to be published unless it has a featured image. When I commented it out and tried deleting the articles, it started working … Read more