You have miss the last parameter from get_post_meta().
Try below code:
$literature = get_post_meta(get_the_ID(), 'popis_literature', true);
It gives you array of IDs. E.g.
array (size=2) 0 => string '32985' (length=5) 1 => string '59956' (length=5)
So in query you can use them like:
$args = array( 'post_status' => 'published', 'posts_per_page' => -1, 'post_type' => 'post', 'meta_query' => array( array( 'key' => 'popis_literature', 'value' => $literature, 'compare' => 'IN' ) ), );
Related Posts:
- Use REGEXP in WP_Query meta_query key
- Getting attachments by meta value
- What is an efficient way to query based on post_meta?
- WP_Query not working as expected for attachments and custom meta_query
- How can I create a WP_Query that returns posts where one meta_value
- WordPress altering my custom query, How to fix it?
- WP Meta Query for some meta (array) values
- How to get sum of meta_values of a meta_key in wp_query according to conditions
- Order posts by meta value and Date
- Get meta info related to current post
- How to make Meta Query case sensitive?
- Performance when getting post meta for post retrieved by meta value
- Get attachment by meta_key value
- Fetch Record based on meta key dates
- how to make members list directory through wordpress post custom meta key.
- Large AND OR query timing out
- Filter posts by comparing custom meta value against postdate
- Nested array issue in meta_query
- Query posts by searching for a string in a meta field
- WP_Query meta compare must include ALL array values
- How do i create a custom post query when the meta value is an array?
- wp query to use both author id and meta_query
- Meta query ignores multiple values of the key
- Trouble with serialized metadata
- show most viewed post
- Why can my filter query SOME metadata but not other metadata?
- Query against multiple locations within single custom post type post
- Saving custom fields for WP_Query to retrieve
- How to show all the associated posts with specific date of data metabox?
- WP Meta Query at depth 2
- WP_Query Posts by Metadata from Option Tree
- Return a single custom post from multiple meta queries
- WP_Query by meta key not returning any posts
- Nested meta_query with multiple relation keys
- Reduce or prevent calling of update_meta_cache
- ACF Relationship Field Search Filtering [closed]
- Query Multiple Post types each with own meta query
- WP-CLI How to generate a list of posts with corresponding meta values
- ACF datepicker meta_query Compare Dates in m/d/Y g:i a – Not in Ymd Format
- Is “orderby” in WP Meta Query conflicting with Meta Query?
- How to count post meta key values for all posts in database
- How should I use posts_where to change meta_value from a string to integer?
- Sort users by meta_value_num
- meta_query with array as value
- how to fire join query with post_meta
- Using WP Query to search within ALL keys in meta query
- WP Query – Get WooCommerce Products with variation that is in stock
- Meta_query with or without value
- Pull post meta with post_query?
- wp_query not searching with apostrophe
- Custom query based on meta key – Reduce three states to two in results?
- Adding an array from a query string to a WP meta_query
- How to display multiple custom fields with the same meta_key in an ascending order?
- Meta_query with multiple keys and multiple values
- Tax query AND/OR meta query [duplicate]
- How do I query for posts by partial meta key?
- Help ordering Post loop by two meta values
- New WP_Query loop in admin causes problems
- How to increase load time of an archive/search page (WP_Query)
- Which is faster wpdb & get_row or wp_query & ge_post_meta?
- Hide posts with meta key in WP_Query
- meta queries do ‘either/or’ checks
- search serialised meta_value for date value?
- Is this meta query problematic?
- Appending to existing WP_Query’s meta_query if exists
- Get every post with value in meta key
- Get meta_value of a specific meta_key from all posts belonging to a specific custom type
- Custom query filter by ACF date custom field
- Error in meta_query not get result
- WP_Meta_Query object with conditionals
- How to get current page nearest parent id?
- meta_query with array as value with multiple arrays
- Why doesn’t my WP Meta Query return any results?
- Order (by ASC) posts with meta_key so posts without values are last
- meta_query – check for multiple meta values in key which holds an array of values
- Searching for a specific month in a metadata saved as Timestamp (Wp_Query)
- WP_Query on custom key and value
- Get posts having meta value between two numbers
- update_post_meta performance in a loop woocommerce
- Pre get posts sort by meta key returns no results if meta key does not exist
- I need query_posts() to order results first by a meta value and then by post ID
- meta_query with relation = AND not working as expected when combining EQUALS with NOT EQUALS
- WP Query for Multiple Post Types
- Meta query doesn’t remove placeholder escape before query
- Order Posts By Custom Field That is an array of objects
- Orderby query does not work for custom fields even with meta query
- make query more simplest and in one query
- WP_Query – show posts where meta value and user_email match
- WP_Query using meta_query with LIKE doesn’t return what it should
- Use not custom fields in get_posts() meta_query?
- Compare meta key separation
- WordPress Query Default Order if Meta Values Same?
- Including ‘cat’ => $cat breaks meta_query
- Custom query (author is post_author or meta co_author) with Pagenavi pagination
- Wp query by 2 meta field – check if they exists / have 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
- Extend search query to search meta keys values based on search string