Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

How to get specific post meta by title or id

get_field is a replacement for get_post_meta you have to use only it:

$my_post_meta = get_field('album_image', 556);

if ( ! empty($my_post_meta) ) {
   // use the image
}

If you don’t know the ID and want retrieve the post meta via post name, you have to use WP_Query or get_posts to ge the post via slug:

$posts = get_posts('post_name=here-the-post-name&post_type=release');
$mypost = ( ! empty($posts) ) ? array_pop($posts) : false;
$my_post_meta = $mypost ? get_field('album_image', $mypost->ID) : '';
if ( ! empty($my_post_meta) ) {
  // use the image
}

Related Posts:

  1. Custom meta fields not showing up in WP_Response Object via custom endpoint
  2. Querying meta values within an array
  3. Advanced search form with filters for custom taxonomies and custom fields
  4. Multiple orderby values in WP_Query
  5. Meta query with boolean true/false value
  6. Get post with multiple meta keys and value
  7. Custom field values deleted when trashing custom post type
  8. How to get all custom fields of any post type
  9. Search multiple custom fields by using meta_query
  10. How do I Paginate Search Results for Custom Post Types?
  11. Sorting a query by custom field date
  12. Filtering a WP Query result
  13. How to sort CPT by custom meta value (date), and return posts month by month
  14. How Do I Use WP_Query to Run This Database Query as Search Result?
  15. WP_Query on custom post type not displaying, multiple loops & get_template_part
  16. Comparing timestamps in meta query doesn’t work
  17. WP Query group/order by category name
  18. wp_query to find posts by year and month
  19. How to dynamically attach pictures to a carousel
  20. how to interconnect custom post types?
  21. WordPress Orderby Numeric Value Not Working
  22. List all images from a single post meta value
  23. Including Custom Meta with posts_where query
  24. orderby in custom WP Query does not work
  25. WP_Query: include custom post type only with specific meta value
  26. WordPress custom loop filter by meta_key and value with serialize data
  27. Meta Key Value in current-user-only loop
  28. How to implement a Google map store locator
  29. Posting to a Custom Post Type from front end – user generated content
  30. Update Post Meta for a logged in user
  31. Problem querying Custom post type by custom fields
  32. Orderby CPT custom fields not working
  33. Two Custom Post Types Many to Many Relationship
  34. get_post_meta not working on publishing
  35. Query custom post type with ACF Date
  36. Query Multiple Custom Posts by Custom Fields
  37. WordPress request fiter order by related post’s post_title
  38. Order Custom Post Type by Custom Field Value
  39. First custom field value (out of several) displayed twice after query
  40. Possible to filter custom post type with multiple meta data?
  41. Custom fields for custom post type
  42. create custom meta box with default value
  43. delete_post_meta() for whole CPT / multiple posts?
  44. $post->post_meta not pulling any post in wordpress/php
  45. WP_Query of custom post type sorted by meta_key has unexpected results
  46. Cannot obtain custom meta information
  47. Group by custom field value (start and end times)
  48. How to call a post’s metadata in shortcode.php?
  49. WP_Meta_Query object with conditionals
  50. delete duplicate meta_value with same post_id
  51. Search CPT Title AND Meta
  52. updating one custom meta field only
  53. Add a class to post_class if more than one post shares same meta_value_num
  54. Add a meta field to the list of results for a custom post type
  55. Empty meta-box returns publishdate if no value is set?
  56. How do I list a custom field and custom taxonomies for each result in a loop?
  57. Filter search posts by post meta?
  58. Custom fields for post or terms which don’t update on post update
  59. Alike Shortcode using in Custom Shortcode
  60. Query custom post type that has a serialized relational advanced custom field value
  61. WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
  62. WP_Query get always custom post_type for first
  63. Sort custom post column by generated value?
  64. Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
  65. How can I query and sort custom-post type using WP_Query
  66. Use WP_query to match post types based on custom field values
  67. Filter posts by their related field’s custom field
  68. How can I add a meta[] to my custom post type and search by term with the Rest API?
  69. Show posts from WP Custom Post Type selected from a field in a metabox
  70. Query custom post type and custom field by URL parameters
  71. Creating an archive page or simple template to list all values of a custom field of specific post type listing
  72. Query a Custom Post Type using SELECT that has ACF fields to compare dates
  73. meta query multiple values for the same key
  74. How to get post by meta value
  75. Custom post types – meta_query: search lesson which starts sooner
  76. Post Filtered by Custom Field Value
  77. How do I get all authors posts of a custom post type outside loop
  78. How to Disable option of meta field if that option is selected for any other post in custom post type?
  79. Filter custom WP_Query by first letter of a custom field – hopefully using Search and Filter Pro?
  80. sorting in wp query based on custom field value
  81. Linking posts together with Advanced Custom Fields “both ways”
  82. WordPress query in which condition uses custom field
  83. WordPress loop add heading before first of type
  84. How to make a shortcode for my WP_Query Loop? [duplicate]
  85. How to get Current week and current date record wp query
  86. Error in WP Query. If variable is empty it is displaying previous post value
  87. get_post_meta for Custom Post Type ( CPT )
  88. How to add post reference field to a plugin?
  89. WordPress custom post type
  90. Custom Post Type meta oembed html output resulting in WSoD
  91. WP_Query and two custom fields returns no posts
  92. Storing/querying custom date data
  93. Custom Post Type + Custom Meta Query Not Showing 2012 Posts
  94. How to show all posts of specific custom post type with their custom fields values?
  95. querying to custom field over ACF REST API
  96. Display ACF object field data using Elementor Custom Query
  97. WordPress custom field sorting, weird behavior: the latest post is at the end
  98. Sort CPT by taxonomy AND THEN by custom field
  99. WP Query + custom fields: How to query event posts from the current date backwards 6 months and organize it month by month?
  100. Quering a post object based on another related post object
Categories custom-post-types Tags custom-field, custom-post-types, post-meta, wp-query
Submitting form in wordpress plugin
Injecting HTML on (arbitrary) admin pages

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress