$category_in = array();
foreach($topicsofinterest as $topicofinterest){
//Chaneg 'category' to the taxonomy name.
$term = get_term_by( 'name', $topicofinterest, 'category');
$category_in[] = $term->term_id;
}
Just curious, why don’t you store the category ID instead of category name in user meta?
Related Posts:
- Display Featured Post by Categories and Avoid duplicated posts
- Search Query for multiple categories using ‘OR’ but having certain categories be ‘AND’
- How to echo woocommerce category name
- How to get posts by category and by choosing a taxonomy term?
- get_the_terms has strange result since version 6.0
- How to use the Term Object from a custom select field in a query
- Category Archive not working for pages
- Using WP Query, I want to include all posts in category 1 as long as they are not also in category 2
- WP query taxonomy input differs to output?
- Combine two taxonomies in a hierarchical tree
- Exclude posts that only have the ‘Uncategorized’ category [duplicate]
- Why is my WP_Query not working when tax_query terms are an array?
- How to filter by category in REST API, excluding posts also in other category term?
- How to order category.php loop by ‘meta_value’?
- How can I display recent posts from a particular category in my header?
- Move posts to top of WP_Query if in certain Taxonomy?
- Querying Multiple Custom Taxonomy Terms
- WP Query – Get WooCommerce Products with variation that is in stock
- How to show only one post for each categories of taxonomy of custom post that contains a specific custom field
- How get posts from a subcategory of a category by name?
- Filter WordPress posts by between parameter
- How to Modify Taxonomy Archive Page with Search Parameter?
- How to add terms to my tax_query based off of the current post
- Get image of latest post from taxonomies/categories
- How To Remove/hide some specific categories from two different categories widget from sidebar
- Display link to taxonomy archive only if it has posts with certain custom field values
- Is it possible to dynamically get queried term AND taxonomy?
- WP Query for variable taxonomies
- WP_Query arguments to fetch custom post type posts which are in certain category?
- How do I reset this wp_list_categories query?
- How to show subcategories using loop?
- How to show CPTs in term archive
- Function get_queried_object() return NULL in custom taxonomy
- Getting Taxonomy inside WP_Query Loop
- Remove a specific category ID from related post
- Complex Category selection as per user input
- Show all post for a given category
- Complex WP_Query (two post types and multiple operators)
- Five posts from a category in footer
- How to get all unique categories for posts in loop?
- Remove category from query (show all posts in archive.php) pre_get_posts()
- Cluster WooCommerce products in each Category Archive by Tags assigned to products
- Get authors by term id or slug
- WP_Query tax query part of slug
- Can we return all category (not post) with Custom Query Filter? [closed]
- Taxonomy Query Relation field not behaving correctly?
- How to Union two different conditions in one WP_Query
- Query posts intersecting tags and categories
- How do I exclude the lowest level terms in a taxonomy?
- Check if loop has any categories?
- Exclude Category filter from Portfolio section
- Post loop for all taxonomy terms
- Inserting HTML to close and open divs in WP_Query loops
- Taxonomy order exception for specific term
- Combine results of multiple WP_Query to resemble single WP_Query
- WordPress Custom Search Form Displaying Unexpected Results
- Get posts from multiple tax terms
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- Loop posts based on permalink term
- Loop categories by recent post
- Getting the permalink to the latest post from a category
- What is wrong with my WP_Query Arguments?
- relation OR instead of AND – Filtered term ID’s in loop
- Don’t repeat posts from children in parent taxonomy query
- Widgets: Show Recent Posts Only if the Posts Have Both Categories X and Y
- Show multiple tax_query from 2 or more post_type in a single code
- `offset` WP_Query argument dont work via `pre_get_posts`
- Function the_posts_pagination() not compatible with WP_Query arguments
- Filter products on category AND tag
- Strange behaviour of hierarchical taxonomy archive
- adding pagination to a foreach loop in wordpress
- WP Query should show No Posts when tax_query $args taxonomies don’t have associated posts
- tax_query not working on custom post type
- Save queried result into database
- 3 posts from each existing category on one page
- WooCommerce WP_Query using tax_query returns no results (0 = 1)
- Related categories order posts by category
- WordPress – Form does not filter the results of taxonomies
- How to show specify category template for both parent and child category
- Display All Top Child Categories / Taxonomy
- Show one post of each custom taxonomy
- How to break up output of posts for different terms on same page?
- Custom category page with taxonomy filters
- Show posts from categories instead of tags
- Multiple values in WP_Query : category__and
- taxquery taxonomy get terms
- How to define a custom hierarchy for terms?
- Pull posts from all categories if quantity is not met?
- Custom taxonomy and query multi conditions
- Retrieving category pages from subcategory returns empty sets
- Empty ‘terms’ in ‘tax_query’ returns an empty array
- query.php – multiple is_category functions
- Create multiple sections for all categories and then queries all the posts for each of those categories
- Get the tax term in which is a post via wp_query
- category_name not working in WP_Query
- query_posts problem – need help
- Multiple Orderby is not working right
- Filter posts by category
- Custom query for certain post type OR another post type with a certain category
- Pagination only showed when no category is set in wp_query