try this here i get category on three page
function tpa_exclude_technology_cat( $query ) {
if ( !$query->get_queried_object_id('8') || !$query->get_queried_object_id('Berries page id here') || !$query->get_queried_object_id('Stone Fruits page id here')) { // "Fruits"-page has id of 8
$query->set( 'cat', '-3' ); // "Fruits-Category" has id of 3
}
return $query;
}
add_filter( 'pre_get_posts', 'tpa_exclude_technology_cat' );
Related Posts:
- What does the token %1$s in WordPress represent [closed]
- exclude multiple terms using get_terms() function
- retrieve thumbnail from post ID of best selling product in category
- Custom HTML structure in wp_list_categories
- Archive listing of posts by publish year (multiple years)
- Add custom field to attachments in a specific category
- Display all posts in current category
- How to Populate the list of custom post type categories
- Php string not working in WordPress Functions.php [duplicate]
- How to display related posts from parent category
- User Defined order on get_categories?
- How can I set custom order use this function
- Error: array_map(): Argument #2
- Put a link to a category round a hard coded A HREF
- Check if Product is in a Specific Category in Functions.php
- How to exclude specific category from the get_the_category(); array
- Display all categories including sub categories
- Category Thumbnail Display – How to display ONLY the main Category
- combine Code 1 with Code 2
- How to use transient in this code for related post?
- Creating a related post section based on similar categories
- Swapping wp_dropdown_categories function with wp_category_checklist
- What is an equivalent of single_cat_title for getting the slug of the category?
- Issue adding sub category programmatically
- Grab posts by multiple categories
- Move category description below post list in blog
- get_template_part based upon post’s category
- how to save selected option in variable for rest api category filter
- Setting default category base on theme activation
- Recent Posts Not Showing Only On A Specific Category Page [closed]
- Different post styles depending on category
- Display category name only once inside loop
- Dilemma of Populating all the categories in a drop down list
- Define specific category name in PHP
- JSON REST API WordPress only showing first 10 categories
- Category title output before opening title tag
- Include Parent Term in wp_list_categories
- I’m trying to create an array with a foreach loop, but the array only stores the last item [closed]
- Get all categories post is not in
- Rewrite with pagination /foo/page/2/ to posts of a given category, page 2
- How to get category name or ID by post?
- How to hide posts of a specific custom category in WordPress?
- Post not populating for custom post type based on category selection
- Add new post in existing categories using wp_insert_post
- How to change logo by category
- Problem with custom loop and wp_list_pluck [closed]
- Listing titles and custom fields of entries within subcategories
- random display categories – change url
- Output category list inside array
- Do not duplicate posts with multiple categories in multiple loops
- Removing sidebar on category pages
- Define category ID using get_post_meta
- How To Pass Array To get_the_category_by_ID() and Get An Array Back?
- go to home page when i select default in select-box
- Adding wp_list_categories to a specific div that was appended using jQuery
- Counting number of posts in multiple (sub)categories using shortcode
- Wrong Number of Products When Hiding Subcategory Products From Showing In Parent Category
- I need to display posts in subcategory beside posts in main category
- Order category posts by last word of custom field
- How do I edit the terms output args or array data?
- Change category thumbnail size
- Get nice name of category from slug (remove dashes of category)
- Display Visual Composer shortcode if a post belongs in specific categories
- admin panel – How to remove “delete” button from category editing page
- Get parent category name when only child category is applied to a product
- Multiple Tag Filtering
- How does Permalink work with the AMP plugin after Removing Parent Permalink Catalog from Posts
- Polylang and template files
- Notice: Undefined variable
- Show subcategory name selected in specific category woocoommerce
- Return to the beginning of the results of a for loop
- Exclude category and post from loop in custom category.php
- Admin backend, show post from a category and exclude the posts from subcategories
- Populate Posts based on category selected using AJAX that means without page refresh
- random woocommerce categories are not showing when count enabled?
- Exclude a category slug on pagination
- Custom content using in_category
- How to Retrieve All Category Images on Front-End
- PHP drop down menu for my get_category child of
- Short code into PHP
- Need Quick Help With Product Category Page
- Need to adjust condition to say if I’m pulling categories from a post, to pull only the first one
- Rearrange get_categories array compared to another array
- Search in particular category in wordpress
- Query seems to be duplicated
- Top menu disapears in Category Pages when filtering using ACF
- Is there a way to randomize and connect a background and header image?
- Error trying import one category on page
- dynamically filter by category via sub-menu
- Remove the_content From Loop
- Category List in Theme Options Page
- Get unique post in parent category
- Code that displays images – images get shown multiple times
- Incomplete term slugs output from a foreach loop with get_the_terms
- Display post of specific category on page
- Displaying categories
- Product Category Page in Full Width
- Display all categories (with link) of custom post type – WordPress
- Display featured posts first, then display all others within a specific category in WordPress
- Can’t assign menu parent id or menu item breaks