Custom post type category pages pagination returns 404

The issue I’m having is with the pagination on category pages, e.g. /release-notes/category/upgrades/, where pages 2 and beyond return a 404. That’s because your custom rewrite rule does not support paged requests, i.e. it’s missing the RegEx ( regular expression pattern ) and query for the paged parameter. So you can either add another rewrite … Read more

Custom Field in Page Title

Use the wp_title filter, which passes the current title, separator, and location as arguments. It then appends the custom field value to the title if the conditions are meet. For more details :- Visit Link wp_title function wpse_224340_document_title($title, $sep, $seplocation) { global $post; // make sure the post object is available to us if (is_singular(‘mec-events’)) … Read more

How to disable the single view / search /archive page for a already-built custom post type?

this custom post type is created by a plugin, I can’t update the register_post_type code You can use either the register_post_type_args or register_<post type>_post_type_args hook to filter the post type args like the publicly_queryable in your case. See an example below which uses the former hook, where I also set exclude_from_search to true to exclude … Read more

Custom post type template not loading from plugin

I think your first method isn’t working because it’s a theme method, not a plugin method. I could be entirely incorrect but I think the method of using single-custom_post_type.php only works for themes. (Again, I 100% could be wrong.) However, this is what I use and it always works: function wpse_post_type_templates( $template ) { if( … Read more

WP_Query not using relation key as expected and not producing any results

From the developer docs: relation (string) – The logical relationship between each inner meta_query array when there is more than one. Possible values are ‘AND’, ‘OR’. Do not use with a single inner meta_query array. (Emphasis mine). It’s a bit hacky, but you could run a separate query against the meta field, then merge the … Read more

Custom Post Types Do Not work on this permalink setting https://somedominaname.com/%category%/%postname%/

The Permalink structure setting on the Permalink Settings admin page is only applied to the default post type, i.e. post. For custom post types (CPTs), you can set the permalink structure (for posts in your CPT) when registering your CPT, via the rewrite argument for register_post_type(). But, if you want to use %category%/%postname% with your … Read more