Well… you could grab category names ID using get_the_category
function(WordPress Codex).
$names = {"japanese", "dessert"};
$categories = get_the_category();
if($categories){
foreach($categories as $category){
if( in_array($category->cat_name, $names) ) array_push($ids, $category->term_id);
}
}
Related Posts:
- How to show in search results posts with a particular tag in a particular category?
- How can I hide a category from Contributors in the edit/add new post screen?
- WordPress Multiple Category Search
- How to get posts from two categories with WP_Query?
- Exclude categories from search query
- Multiple Domain Names – One WP Install (non-Multisite) – Default Each Domain name to Category Archive
- how to use a different domain/subdomain for authors/catagories on single site?
- Delete a specific category when deleting a user
- How to list child categories in custom category template?
- Trash bin for categories
- How to set up sub-categories for author pages?
- View category in the preview of Theme Customizer
- Custom query with category exclusion and post-meta “whitelist”
- One WordPress Install, Two Categories. Each Category Gets a Domain
- Block multiple categories from Blog
- Exclude most recent posts from specific category in wp_query()
- Create single.php for specific category by category id
- Show posts of one category only with Custom Taxonomy on single.php
- Select category in custom query
- Display one latest post from multiple categories
- Remove “Parent” Selection When Adding/Editing Categories?
- How to query posts from specific authors and categories using WP_query?
- Apply custom category template to subcategories
- Hide post meta data on a specific category
- Format Brand value in Category view [closed]
- Add custom taxonomy under the category title
- What is the advantage of using header-catname.php over is_category(‘catname’);?
- Custom WP_Query for current category (in category.php)?
- Multiple menu items highlighted
- Use a wordpress page to display a certain category
- List Posts by Category for a Non-Zero, Non-NULL Custom Field Value?
- How to view WordPress’ default category IDs?
- getting content from main domain to sub-domain using category and WP_Query
- Multiple Category Search
- How do I add a function on a specific post category?
- How to customize category template?
- Category-slug.php not being used
- How would I go about adding custom header images per category?
- Display posts separated by Category in Author’s page
- How to categorize posts under Category 1 and Category 2 which are separate lists of categories, and display them as separate lists in widgets
- Multiple Loops on category.php with pagination on last loop
- How to rewrite the post URL according to the category?
- How to get latest posts from each category in regular order
- Redirect to another page using contact form 7? [closed]
- Display thumbnails for certain category posts
- Is it possible to remove from default category widget?
- Display posts from a category
- category__not_in and id values from variable
- Use premade array as categories in wp_query?
- Multiple selection for wordpress widget
- Different CSS class by category
- Wrong category nice name is displayed on archive page
- Remove any product that is featured from regular display loop [WooCommerce]
- Two Sections on Woocommerce Catergory Page [closed]
- Theme for subcategories
- WP_Query – using category__and when one of the categories is 0
- More efficient way to list posts by category [duplicate]
- Query posts by views on category page
- Custom css per category and per single post belong in each category
- Show multiple categories in query using redux framework variable
- Are term_taxonomy_id and term_id the same? [duplicate]
- Using in ‘category_name’ in ‘$query->set();’?
- Custom Page Template Category loop not functioning correctly
- How to hide widget from certain category
- custom query for both category and pages using global $wpdb;
- I would like to feature a tip on the homepage
- new WP_Query issues
- SQL query to get posts from multiple categories but not in a category
- How can I use AJAX with check-box categories?
- wp_delete_term or wp_delete_category?
- How to display the 5 latest post titles but allow only 1 in there of a specific category
- Custom Portfolio Page
- Last x Posted Categories?
- I need advice on how to structure the categories according to the layout i have
- show only sub categories if available?
- problem with filter of custom portfolio categories
- Deleted categories still listed until additional page refresh
- Category custom template is not showing correct posts
- Search Replace Database ONLY for posts of certain category?
- Filter custom taxonomy posts via AJAX
- Need help to structure our a complex hierarchy
- Show posts from all categories
- Unable to get all tags from specific categories
- If it is a top level category show children otherwise show sibling categories
- Display related posts with same category or same tag return blank
- $args Orderby The number
- Querying Multiple Categories With Different Offsets
- WordPress Numeric Pagination with Query String [duplicate]
- Printing direct descendants of a category with WP_Query
- Custom Category Page Not Working [duplicate]
- WP_query exclude a category unless it has more than one catagory
- Show only one category in main query, issues on tag page
- How do i add custom post types to this query?
- List all authors by matching custom meta data on a category page
- why is the delete option missing from just one category?
- Narrow Down a Shop Page Results Based on a Product Tag in WooCommerce
- How to prevent page re-sizing for mobile browsers [closed]
- Custom permalinks structure
- Woocommerce custom taxonomy order
- Trying to WP_Query a category