$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?
- How do I get the category URL from get_the_category?
- is_category() in pre_get_posts strange error
- How do I use the same post slug for different Categories?
- 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
- Using same slug name for a page and category
- Add category to custom post type automatically, using category slug
- Custom Query to search through categories
- How to query all posts of a specific category, and any other category combination
- 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
- Removing the number in a category slug
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- How to Check if a Child Category is Being Queried
- Deleting All tags except categories Wp database
- Plural Category Base Slug On Category Archive Page
- Return category slug / title from category ID
- 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
- If newest post of category is newest post in general, skip first post of category
- 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
- Need to pull parent category and slug – only pulling daughter 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
- The default code for “posts_nav_link” on category.php isn’t working
- 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
- category pagination got broken suddenly
- 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?
- Where and when does WordPress invoke routes
- how to get full category path including parent and subcategories
- 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
- function query_posts disabling current_page_menu class
- 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
- How to filter post from categories only if the posts appears in one of them, not the other?
- Category name for all posts getting assigned to a single random post
- Show Posts via cat+cat in URL that are in both Categories doesn’t work
- pagination 404 error, same slug home and categories
- Different post slug based on archive
- List of post categories only associated to another custom taxonomy
- A different permalink structure for different categories
- 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
- How to prevent WordPress from redirecting single page to prefixed category archive with same name?
- 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