Change Number of Posts Displaying on a Custom Post Type (CPT) Archive Page

Pre Get Posts Display

To change the number of posts that appear in an archive page for a custom post type you can change the number using the pre_get_posts action with some passed in parameters. Normally the number of posts displayed per page is defaulted to the setting in the Dashboard Reading Settings > Blog pages show at most –…

Read More

Completely hide WooCommerce products from shop, product search and WordPress search

Hidden Woo Products Showing in search

You can hide a WooCommerce product from the shop page and product search by choosing ‘Hidden’ in the ‘Catalog visibility’ options from the Publish metabox on a product page in the backend. This is good and it hides the product as advertised from the shop and product search results but the product is still visible…

Read More

Show Custom Post Types in Category Archive Page

By default WordPress custom post types do not appear in a category or tag archive page, to change this behaviour and display the custom post type you can add this filter/function to your themes functions.php file. function themeprefix_show_cpt_archives( $query ) { if( is_category() || is_tag() && empty( $query->query_vars[‘suppress_filters’] ) ) { $query->set( ‘post_type’, array( ‘post’, ‘nav_menu_item’, ‘custom-post-type-name’…

Read More