$category_slug_array = array('slug_1', 'slug_2', 'slug_2'); //array of category slugs
foreach($category_slug_array as $category_slug){
$my_categories[] = get_term_by( 'slug', $category_slug, 'category'); //getting category object by slug
}
print_r($my_categories); //printing array of categories
Related Posts:
- Overriding default calendar to show posts from a category
- SQL query to get posts from multiple categories but not in a category
- Category slug in in loop always the same?
- is_category() in pre_get_posts strange error
- Rewrite rule page url with category
- Rearranging posts based on categories
- Create terms when registering taxonomy?
- How to create non-unique sub-category slugs?
- Rewrite category slug
- Custom Query to search through categories
- is_category in pre_get_posts results in php notices
- I use same slug name for category and page
- Divi change project slug based on category
- Query the Loop without breaking it
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- Plural Category Base Slug On Category Archive Page
- How Do I Merge Categories With phpMyAdmin
- Duplicate Category and Page URL loads Category instead of the Page
- Category archive page – loop through posts of certain tag (with pagination) – pre_get_posts
- Category slug $_SERVER[‘REQUEST_URI’];
- 403 forbidden on one page only
- Get the name an the description of a link category
- Using a portfolio_category slug in wordpress URL
- Disallow categories from this MySQL query
- Categories vs. Page Site Organization
- WooCommerce duplicate sub categories and product slugs
- Include posts from feature category in pre_get_posts
- How to display posts under a specific subcategory of a given category
- get_the_category and echo out link to child-most/deepest category
- List of the years with posts presented
- Pagination for category slug returns 404 when page >= 2
- query in category.php repeats itself
- Displaying a full post instead of a slug per category?
- Modify WordPress SQL Query to pull from within a category
- Display posts separated by Category in Author’s page
- wordpress sub-category ( lowercase letters + non-latin characters ) = 404
- Category param redirect to post type archive
- batch adding posts to a category based on matching regex for title with SQL
- How to get related tags based on a category?
- SQL to migrate post types to taxonomy
- Mod_Rewrite to show only last subcategory in URL
- Show popular post by category code
- How to get latest posts from each category in regular order
- Get posts from specific taxonomy term
- Custom SQL Query: Get all posts with category id and a concated list of tags on each post
- Get posts under a category with SQL
- How to query categories with Advanced Custom Fields?
- And/Or Category Query
- Automatically redirect a page to a category that share the same slug
- Get a count of how many times a term or a category is used in posts
- Use the category name instead of category slug in permalinks
- SQL query to return categories and category parents
- Exclude category from query
- How do I add a tag slug to a category URL to filter posts?
- Change of category structure will cause two kinds of URLs for one post
- Change slug of Standard wp Post category
- How to remove the category from post slug
- How Do I Delete WordPress Posts Older Than 400 Days, From A WordPress Category
- Ordering categories by slug vs. name
- Using in ‘category_name’ in ‘$query->set();’?
- custom query for both category and pages using global $wpdb;
- Get categories of queried posts
- Query from multiple category (and)
- How to display posts from specific category using get_option function?
- Echo Category Nicename
- Conditional category query breaking?
- Assign a list of categories with a parent category
- Display latest post from WordPress Featured Category that is also in X,Y,or Z categories
- Category name for all posts getting assigned to a single random post
- pagination 404 error, same slug home and categories
- Different post slug based on archive
- List of post categories only associated to another custom taxonomy
- OK to redirect the root WordPress category slug?
- How Can I Use Equal And Question Mark In Category Slug?
- How to remove category name for only one category?
- how tho change number of posts in loop from specific categories
- Include a page’s “category” in its URL
- Using the slug of a custom post category as prefix for the underlying custom post slugs
- Change the full slug for a specific category?
- Bulk Change WordPress category Slug
- How to run select query of post with category and tags?
- Issue with WordPress category search
- Querying posts from two different categories while looping inside another loop
- How to auto update post title and slug with category name when post status is updated
- Hide category name using mod_rewrite
- Too many categories drastically slow down my website
- How to get posts from many categories using WP_Query
- Is it possible to query the result of a query?
- Show only one of the categories of a post in the breadcrumb?
- show posts found in multiple categories via category_name query string?
- Help with SQL query, how to add taxonomie terms with value stored in options?
- hierarchical taxonomy in permalinks? using same slug
- Match two taxonomies to display a specific content
- woocommerce – products by category slug? [closed]
- display certain category on custom template page
- How to use Greek characters/letters in a query?
- Displaying posts by year
- finding out the top 5 source ( source is a custom taxonomy ), in a given category
- How can I get rid of the the category suffix–NOT “prefix” (i.e. foo-1, foo-2, etc)
- How to add custom prefix before category base for category page URL?