Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Include Custom Post Types Categories to the main query

function custom_post_type_cat_filter($query) {
  if ( !is_admin() && $query->is_main_query() ) {
    if ($query->is_category()) {
      $query->set( 'post_type', array( 'post', 'YOUR CPT' ) );
    }
  }
}

add_action('pre_get_posts','custom_post_type_cat_filter');
Comment

PREVIOUS NEXT
Code Example
Php :: wp functions ajax get 
Php :: how to pass value in app.blade 
Php :: registerd navigations file uploadid 
Php :: cake php 2.x sql dump 
Php :: Include Or Require Multiple Files On 1 Line 
Php :: https://stackoverflow.com/questions/34545641/php-artisan-makeauth-command-is-not-defined 
Php :: check not empty in laravel blade 
Php :: laravel 8 remove public folder from url 
Php :: 100 rows update php 
Php :: mysql php update sum same table 
Php :: command working in terminal but working from code php 
Php :: YYYYMMDDTHHMMSSZ php 
Php :: wordpress widget categories edit 
Php :: .htaccess Preventing access to your PHP includes files 
Php :: filter elementor 
Php :: Round A Number 
Php :: laravel add model to polymorphic relationships 
Php :: laravel 8 template favicon 
Php :: Right triangle start pattern of star 
Php :: source code in html to add two numbers together 
Php :: union type php does not work 
Php :: array issue in php 
Php :: symfony postgresql 
Php :: wp_handle_upload return uploaded file name 
Php :: undefine variable $variable in php 
Php :: MySQL eqSql Connection 
Php :: laravel belongsto nested 
Php :: trait class has consttoctor 
Php :: laravel dompdf barcode 
Php :: dreamweaver laravel plugin 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =