The ‘category__in’ parameter accepts an array. You’re giving it a string of comma-separated values. Also, you need to use explode()
instead of implode()
. implode()
is for joining array elements with a string, while explode()
is for splitting a string by another string. Try this instead:
$args = array(
'category__in' => array( explode( ot_get_option( 'beautiful_categories' ), ',' ) ),
);
$query = new WP_Query( $args );
Related Posts:
- Is There a Difference Between Taxonomies and Categories?
- Only one category per post
- Get rid of WordPress category, tag and author archives?
- Filtering categories in the permalink structure
- get_categories hierarchical order like wp_list_categories – with name, slug & link to edit cat
- wp_nav_menu not appearing for a couple pages
- Why aren’t sub-categories nested after creating post in the WP Admin?
- Preventing index.php?category_name=something from redirecting
- How to get category id of current post?
- Programmatically create product category and add thumbnail in woocommerce
- Trash bin for categories
- Categories’ hierarchy in URL
- Display one category in one page
- How to get next previous category in same taxonomy?
- How to add a background image to category and display image on category page
- How we add new categories by wp_insert_post
- Show Subcategory Description
- Check is category parent or not from its ID
- I want exclude the particular category in sidebar
- Which php file lists all the post of a category
- How to query posts from specific authors and categories using WP_query?
- Apply custom category template to subcategories
- How Can You Exclude Categories From Your RSS Feeds?
- Retrieve all posts within tag OR category?
- Include template before a loop
- How to customize tag and category post listings to show introductory content?
- List Terms in Category
- Can you have a single set of “canonical” categories shared by all blogs?
- List Posts by Category for a Non-Zero, Non-NULL Custom Field Value?
- How to get category URL with the slug?
- Rename Default Category (Uncategorized) Via a Function
- How to customize category template?
- Customized landingpages for categories
- get_the_category_list open in parent window
- Show category images on single product page and product overview page
- Class active for Archive link – looped out
- need to add custom field in more products
- Get parrent category name
- Display specific categories by ID
- Sorting category products not working
- Show category from “Next post” and “Previous post” [edited]
- Remove sub-menu item from admin menu
- How to add WordPress sub category without select
- wp_list_categories in in nav_menu
- How to customize categories panel?
- Get posts from 2 different categories
- ACF add custom fields to categories and display
- Custom taxonomy template for categories
- Show category with link
- Random Featured Image Based on Category
- Select posts from Category
- Display a list of subcategories a post belongs to
- Display unused categories in dropdown
- Show Pages in Categories
- get_posts ignoring ‘category’ and displaying all posts
- Get post related on category
- Give Children Unique ID’s
- Some of the category description not showing up in category page
- Function to automatically rename the base category permalink
- Add theme-color meta tag to head?
- How to get an array with all categories and corresponding names?
- WordPress Customizer: Dropdown with Category output
- Custom tax_query filter not working for Woocommerce product categories
- Need to echo category id in multi-dimensional array
- Use blog as base for tags and categories
- Exclude parent category when getting category posts by slug
- category link not working for a specific slug, works for others
- Can’t iterate through 2 levels of categories
- Category URL Management
- Update custom category fields front-end
- Include last post date in get_categories loop
- Add Post Categories in Post Tags Field Programmatically
- How do I remove “Uncategorized” from my theme on my posts page?
- Conditional label Woocommerce archive [unsolved]
- List all categories and count number of posts within based on custom date
- Filter custom taxonomy posts via AJAX
- set a parent category in a product woocommerce
- “Next posts” of a category do not call category.php
- Trying to display all posts in a category
- Remove “Category:”
- A search box for all sites – Multisite
- How to grab posts from the most recently created category
- $args Orderby The number
- Most efficient way to have 1 template for parent, 1 template for child categories?
- If on Category Page add “active” class?
- Function to list posts from current post’s category fails in WP 3.8
- Multiple parent categories
- Custom fields setup when category selected filter subcategories
- How to use Greek characters/letters in a query?
- Make three menus with three category levels
- Getting categories to change appropriately when using $cat = ‘ ‘;
- how to call the category of the post
- Category related -> excerpt, title and thumb in sidebar on article page
- How to have a category not show up in query post with page panigation?
- single category widget with conditional terms
- Remove the current item from a menu
- why is the delete option missing from just one category?
- Get all categories
- Show category post order ASC
- How to display all category images for single post in a page?