Personally I would do this after fetching the user id:
echo '<pre>';
var_dump($user_id);
echo '</pre>';
To check it is getting the $user_id as expected. (int)
This should be a comment, but I am lacking reputation.
Related Posts:
- WP_Query | Help me create a search term with an ‘OR’ relation?
- Why does “get_option” pull in the older value in options.php, rather than the newer value, on submission of a form?
- WP_Query use for a filter with multiple Taxonomies and Terms
- Duplicates with WP_Query loop
- Display Post co-authored in Author Page
- Display related products with custom output
- How do I dynamically generate args for wp_query?
- Sorting Posts | Alphabetical Order
- Looking for most performant way to execute several similar WP queries within shortcodes
- How to query for pages/post depending on slug?
- Get Current User Id Inside a Loop Returns 0 For a Shortcode
- Custom page archive query by url var calling page twice on one of my custom queries?
- WordPress custom slug (endpoint) and compare all links
- How to query for posts with a null or blank post_name?
- WordPress pagination not working with search page
- WP Query with custom Shortcode
- wp_query with cat not working
- How to use an associative array in post__in with WP_Query?
- Recent Posts slider, using WP_Query(), loads duplicate sliders
- Reordering Buddy Press profile navigation [closed]
- Compare post-IDs within WP_Query? (Less than / Greater than)
- How to use $query->set with post__in?
- Making BuddyPress Activity Stream (Post Type) Featured Images Clickable [closed]
- Why do WP_Query results change after updating unrelated Advanced Custom Fields (ACF)?
- How do I programmatically set a user as spam in BuddyPress? [closed]
- Add more button if more 8 items
- WordPress, AJAX and pre_get_posts using conditional tags
- Exclude posts based on meta value
- Custom query, checking values of multiple meta keys
- Remove echo from shortcode
- How Can I use WP_Query to Only Display 1 Post from Custom Post Type if Query Returns Posts with Matching ID in Custom Field
- unable to use ‘new WP_Query’ in AJAX call
- wp_query get the 2nd post
- How to add div blocks after certain set of post
- WP_Query | IF within $args array | Help me only add specific arguments if the argument is not blank
- Convert a string into a decimal number for use in query
- Increment paged on WP_Query
- Hide posts if user is added to it WP_query
- Get all posts as an array ID => Name
- How to hide posts of a specific custom category in WordPress?
- How to insert wp_users ->user login name to wp_terms when a new user registering?
- Passing an array into WP_Query as a variable
- Order BY Most Liked And Published Between Previous Week Monday And Next Week Monday
- Modify main query before it run without pre_get_post
- WordPress WP_Query without query GET parameters
- Sort posts in a specific way
- Do not duplicate posts with multiple categories in multiple loops
- Change homepage content if user is logged in – BuddyPress
- posts_nav_link pulling in multiple post types
- Displaying Event within two given time frames
- Remove Post if Advanced Custom Field is checked to fix paging
- displaying a fall back query if there’s nothing in the post-type category
- Wp favorites posts by specific category? [closed]
- Modifying WP URL handing code?
- Free search and custom taxonomy query not providing the same result
- How do I reset $wp_query in a function?
- Isn’t Returning Value While Using SELECT COUNT(*) FROM {$wpdb->prefix}
- wp_query with multiple arguments with AND
- Replace a single variable with add_filter
- Nested Queries of decreasing specificity
- Wrong pagination results, page counter resets when navigating
- Is it possible to order posts using multiple meta queries, i.e. show posts from first meta query, then the second?
- Sending simple variable on single page to WP JSON
- How to exclude meta no index pages from wp_list_pages
- Load more posts using AJAX based on posts inside WP_Query
- in_array not working on dev server but works on localhost
- meta_query search names when they have middle initials
- WP query posts BUT show the most recent and one per author
- Define global custom post
- How to select post ID for given parent name with nested prepared queries?
- get_filtered_term_product_counts – Get product terms if any products
- Need to show 7 posts from actual date
- Add code to the header of posts by particular author
- Search for single post by 2 tags
- List all ACF field values across every post on one page
- Multiple Arrays for Custom Post Query using Boostrap accordions and ACF repeater fields
- How do I visualize the author’s post from the front end?
- Meta query not showing result properly
- Query to show average # of months all accounts with specific role have been active
- Woocommerce Related Product by 2 taxonomy
- Help on Wp_query to print an term
- Query doesn’t display text data with apostrophes
- making a search.php query
- Querying posts from wordpress with 2 or more conditionals
- SQL Query Search page
- Can’t get data from audio media
- Where is the php file of single member profile view (BuddyPress)
- Display Year and Month from custom field + Age Calculator
- insert thumbnail image from php script
- WP_Query count of different meta key values [duplicate]
- Create a dynamic buddupress tab
- Masonry layout within the loop
- Pagination in category.php not functioning
- Fix incorrect related posts code snippet
- wp_query on search results page showing all results every time
- Variable ++ in query loop
- Count custom posts type and filter by tag
- AJAX WP_Query’s order and orderby parameters not working
- Add adjacent post function inside custom recent post function
- How do I exclude the current post from the upcoming post query