If you use Post Object field type, then it is stored as ID in custom field. So this should do the trick:
$posts = get_posts(array(
'numberposts' => -1,
'post_type' => 'post',
'meta_key' => '<FIELD_NAME>',
'meta_value' => <POST_ID>
));
PS. You should use ‘posts_per_page’ instead of ‘numberposts’ (which is deprecated).
Related Posts:
- How to update custom fields using the wp_insert_post() function?
- Make custom field meta not display if there is not data in it
- How can I add extra word in permalink when someone click download button?
- Which PHP page is the Default Posts Page
- WP_Query: getting posts where custom field exists
- Unable to render custom field after attempt to generate a list of recent post in page template
- Woocommerce Custom Meta Boxes- How to only display if they actually have content
- Query on a repeater date (acf)
- When working with a post, almost all wp_postmeta are deleted
- Posts sortable column not sorting properly for custom field numbers
- tracking number field in Woocommerce order [closed]
- Getting a specific post values to another div or modal
- Trying to add attribute to my posts’ featured image
- Displaying the last post on static homepage
- How can I create a list of page titles from custom meta values?
- Can’t get wp_insert_post to work
- Why not yield/iterable in posts interface?
- Passing the custom field values in the wp_get_current_user array function
- Best practice for migration friendly images in posts/pages?
- Sort posts by custom fields value using dropdown menu
- How to show part of the_content?
- Custom profile field with birthday. Troubles with
- WordPress – Display array data of a child
- Unreadable pagination
- 200 Rewrite blog post links
- How to set a min number of words for a blog post
- Loop through categories and display posts title under each dropdown
- Get post id in a function when edit/add a post
- wordpress allow user to edit user profile with custom fields
- Why do WP_Query results change after updating unrelated Advanced Custom Fields (ACF)?
- how do I get a specific post from a post with a subcategory in WP
- Automatically create child pages and grandchild pages when saving a (parent) page
- Store multiple custom field as post meta per post(css, js, html, 2 link) [closed]
- How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- Need Help Fixing My Iframes [closed]
- Second transition_post_status hook fired instead of the first
- Firing schema via code in functions.php doesn’t work
- How to store post ID’s in cookie or session to display the same posts later
- Adding number to date not working [closed]
- Which hook/action will help me solve my problem?
- Saving and Restoring a Canvas on A Individual User Basis
- Seach custom post type posts only by meta fields?
- How to use thumbnail size of image if I’m only using src to get image
- Post + form + action + results on the same page
- Open post-content in archive page in a Modal box with bootstrap
- 3 Slashes appear after Apostrophe in custom fields after updating product-site
- how to retrieve a value if a checkbox is checked
- Trouble checking if custom woocommerce checkout field is empty or not
- Two queries for a WP_User_Query search work perfectly apart, but not together
- remove post that has no content
- auto-populating custom nav with all items from custom post type
- Loading index.php contents which located outside blog folder for post single page
- get post content of particular post by url
- Add / Update Custom Fields After Select Pictures in Media Window
- Post repeating with infinite scroll
- conditional logic for front-end custom field edits
- Custom posts in different columns style
- Get children post mime type using parent post_ID wp_post
- How to show only subcategories in parent category not parent category?
- Trying to retrieve post meta
- 404 error when I acess the second page of post-type
- Automatic Shortcode Creation with Custom Fields [closed]
- Custom field values to taxonomy terms
- How would an if statement surrounding a custom field with two variables (holding values) look like?
- Redirect to another page using contact form 7? [closed]
- How to add specific meta tags to head of cart and checkout pages in woocommerce?
- Custom Field IF/ELSE PHP
- How to combine 2 php functions into one function with a custom field
- Remove the last X characters of a custom field value
- Advanced Custom Fields – display label and value only if value entered
- Is it possible to retrieve all posts with a certain value for metadata?
- retrieve post data and insert it in seperate static html page without WordPress
- Saving zero in meta box
- WP Insert Post and then go to post
- Non-Closing PHP Query in WordPress Loop
- Why am I getting a different filename? And how does WordPress load singular.php for both Page & Post? (Fresh WordPress installation)
- Returning data instead of echoing/printing
- Display related posts without a plugin
- Find a way to retrive data updated through metabox plugin to web page
- Counting Search results, and displaying the offset per page
- Why are the details of my todo not saving?
- Count posts on multisite with blog id
- Function works everywhere, how to keep it to execute when creating a new post
- Making (and edit existing) posts with ID included
- How to check if a PHP string is different than meta field?
- Can’t save php string to a custom field
- Copy taxonomy terms from one post to another programmatically
- Display custom field on 404 page outside loop
- Why does this update_post_meta function not delete the custom field itself?
- How to show/hide php table rows based on the content of custom fields
- Run str_replace on title and save the output to a custom field
- Parsing Menu Items and Blog Posts
- Pagination on Custom Post
- $wpdb returns duplicate posts
- How to avoid duplicates when creating recent network posts
- How to show an entire post content and not also the excerpt?
- Get latest post from all categories except one
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- Update post title from external file?