EDIT:
You need to get the variable from AJAX in you case you need to do:
function profile_view() {
$user_id = $_GET["user_id"]; // name of hidden input
$args = array(
'post_type' => 'listings',
'post_status' => 'publish',
'meta_query' => array(
array(
'key' => 'stm_car_user',
'value' => $user_id
)
)
);
...
Related Posts:
- ajax category filter
- Order by two meta keys
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
- How to get any tag ID
- wp_query not searching with apostrophe
- meta_query not working as expected
- Error with function in functions.php?
- Loading two different AJAX requests on two different pages
- Getting the post terms ‘wp_get_post_terms’ per post when within the functions.php file
- Multiple meta_key ordering with pre_get_posts
- WordPress dynamic AJAX query
- Finding post ID dynamically on click
- Fetching $_POST from Page Template into functions.php
- Declare inline background image in functions.php
- I wan to process the following js to process the AJAX Request on my function to calculate author Total Post views
- How to query posts based on lat-lng coordinate as post meta?
- Set Alias for meta_query arguments in get_posts()
- Add indexing to meta_value in wp_postmeta
- Is it possible to orderby multiple meta_keys when using meta_value_num?
- Custom WP_Query order by post_meta and (author) user_meta
- WordPress 4.9.5 PHP intermittent warning trim() expects parameter 1 to be string, array given
- Using custom meta_query with relation not working as expected
- WP_Query meta_query where meta value ends in space
- Nested query inside Logical operator OR not working in meta_query
- get data from wp-query, outside the loop & without url change
- What is an efficient way to query based on post_meta?
- How do I create my own nested meta_query using posts_where / posts_join?
- How to order a post type with meta_value_num and if meta_value_num does not exist then order by date
- ‘posts_where’ filter not applying ‘WP_Query’ in `wp_ajax`
- Exclude post on loop by multiple meta key value
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- meta_key and meta_value not working together
- Order posts by meta value and Date
- Query sticky posts with thumbnails
- Order WP Query posts by custom order calculated from post meta values
- how to speed up a complex wp_query?
- How to query for custom field within Gutenberg block from outside of that post? [closed]
- Refine/Filter WP_Query Posts with jQuery or Ajax
- Meta Query for specific months
- Meta query with JSON value
- Get meta info related to current post
- Creating arguments from loop for WP_Query meta_query
- Exclude admin from WP_Query Contributors
- WP_Query ajax loader detect end of posts
- Multiple Loops Inside a Function
- ACF Date Based wp_query
- Ajax Pagination on Ajax filter
- Wp_query returning only one post while query through ajax
- Get attachment by meta_key value
- Using meta_query with multiple keys and compare values
- Mysql query and order meta value
- Load More Posts Button – AJAX
- meta_query BETWEEN, but the range is stored in the custom field
- Is it possible to set specific posts to show first in a query?
- Order ascending is ignored in meta query?
- database query with more than a couple meta hangs and doesn’t complete
- Make meta query treat meta_value as 1 or 0
- how to use pre_gets_posts to exclude one queried ID from homepage loop
- Sort by presence of thumbnail
- it’s possible make a WP_Query with math operations?
- Sorting search results with custom dropdown
- Trying to get property of non-object in: $wp_query
- Change post query onclick
- WP_Query meta compare must include ALL array values
- What’s missing in this wp_query and meta_query
- meta_query weird behaviour, static int will work, but not user data
- ACF: How to query for a given value count of an array like field? (e.g.: How many rows has a `flexible_content` field?)
- WordPress Ajax form filter | Search by title with ajax form, breaks the other filters
- Using Ajax and WP_Query to load more posts on category page fails
- Only show tag with the same id as the post
- Trouble with serialized metadata
- meta_query order by date present -> future then show null
- How to check if logged in user have pending custom post?
- WooCommerce | AJAX | Product Pagination | Help me implement Ajax Pagination
- How to upload 3 attachments to current post?
- meta_query compare > not working
- Custom Post type Ajax search results
- meta_query is not allowing to show posts when querying multiple arguments in a WP_Query
- Saving custom fields for WP_Query to retrieve
- WordPress custom query by archive title
- how to avoid reloading/refresh the page when displaying the post of wp_list_categories
- Is it possible to search for a string in posts OR postmeta?
- Filter posts/pages by user_role array
- WP_Query with MetaQuery issue
- WP_Query Posts by Metadata from Option Tree
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- WP_Query with meta_value_num and meta_query not paged correctly
- Post Query not working after updating to 4.1
- Orderby Meta Value and Query from Meta Query
- The sorting of posts by a meta_query with two keys fails while separated as single queries it works
- Sort posts in dashboard using custom field; also include posts where field isn’t set
- Sort Posts with custom meta key by default which is currently set as optional
- How return normal search result using wp_ajax action for wordpress
- WP_Query with several meta_query-statements and order by meta_value
- How to get all post_id and meta_value using meta_key in wp_postmeta table
- WP Query – Show custom posts only if user contain some user meta
- How do I subquery with custom meta fields?
- Showing Counts on Comment List with Custom Query
- AJAX multiple search boxes not merging with array merge