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. Query all posts where a meta key does not exist
  4. what is the correct way to compare dates in a WP query_posts meta_query
  5. Advanced search form with filters for custom taxonomies and custom fields
  6. Multiple orderby values in WP_Query
  7. Meta query with boolean true/false value
  8. Get post with multiple meta keys and value
  9. Custom field values deleted when trashing custom post type
  10. How to get all custom fields of any post type
  11. Admin Area Custom Type Search By Meta Fields Without Title & Content
  12. Search multiple custom fields by using meta_query
  13. How do I Paginate Search Results for Custom Post Types?
  14. WP_Meta_Query object with conditionals
  15. How to retrive Custom Post Type Meta Fields in Custom WP_Query
  16. delete duplicate meta_value with same post_id
  17. Search CPT Title AND Meta
  18. updating one custom meta field only
  19. Cache issue with WP_Query and custom field filtering
  20. Add a class to post_class if more than one post shares same meta_value_num
  21. Add a meta field to the list of results for a custom post type
  22. Empty meta-box returns publishdate if no value is set?
  23. How do I list a custom field and custom taxonomies for each result in a loop?
  24. Filter search posts by post meta?
  25. WP query_posts group by meta field related
  26. Custom fields for post or terms which don’t update on post update
  27. Custom Post Type meta data getting deleted on bulk editing taxonomies
  28. Custom Form / Search with Custom Post Type Data
  29. After inserting new post with wp_insert_post() the post is not visble to WP_Query, but the same WP_Query works for post inserted from wp-admin panel
  30. Create if else for post types in WP_Query ‘post__in’ values
  31. WP Query from two Custom Post type fields as statement
  32. Alike Shortcode using in Custom Shortcode
  33. Query custom post type that has a serialized relational advanced custom field value
  34. WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
  35. WP_Query get always custom post_type for first
  36. Sort custom post column by generated value?
  37. Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
  38. How to keep custom post type related information
  39. How can I query and sort custom-post type using WP_Query
  40. Use WP_query to match post types based on custom field values
  41. Filter posts by their related field’s custom field
  42. How to sort by multiple values in a nested WP_Query
  43. How can I add a meta[] to my custom post type and search by term with the Rest API?
  44. Show posts from WP Custom Post Type selected from a field in a metabox
  45. How can I fetch all the dates from custom fields from various different custom post types and show / list them at one place in ascending order?
  46. Query custom post type and custom field by URL parameters
  47. Creating an archive page or simple template to list all values of a custom field of specific post type listing
  48. Where is get_post_meta value located?
  49. Query a Custom Post Type using SELECT that has ACF fields to compare dates
  50. meta query multiple values for the same key
  51. How to get post by meta value
  52. Sort custom post archives by a meta value from a different custom post type?
  53. Custom post types – meta_query: search lesson which starts sooner
  54. Post Filtered by Custom Field Value
  55. How do I get all authors posts of a custom post type outside loop
  56. How to Disable option of meta field if that option is selected for any other post in custom post type?
  57. Filter custom WP_Query by first letter of a custom field – hopefully using Search and Filter Pro?
  58. sorting in wp query based on custom field value
  59. Meta_Query refuses to return results
  60. Linking posts together with Advanced Custom Fields “both ways”
  61. Add more custom fields when creating a new custom post type
  62. How do I extract the contents of a CPT’s custom field for all posts?
  63. WordPress query in which condition uses custom field
  64. WordPress loop add heading before first of type
  65. How to make a shortcode for my WP_Query Loop? [duplicate]
  66. How to get Current week and current date record wp query
  67. Error in WP Query. If variable is empty it is displaying previous post value
  68. How to get post meta for custom post type and taxonomy
  69. get_post_meta for Custom Post Type ( CPT )
  70. Query events post type after current date and timezone
  71. Delete custom post type metadata without deleting the post in admin area
  72. How can I get the $key / $value pairs of custom fields that were added via 3rd party plugins or themes?
  73. How to add post reference field to a plugin?
  74. Calling specific page with wp query
  75. WordPress custom post type
  76. How to stop wp_query searching pages as well as the specified CPT
  77. Selecting posts older than the current Unix epoch timestamp
  78. Custom Post Type meta oembed html output resulting in WSoD
  79. Values inside a custom field to determine which category posts to display
  80. WP_Query and two custom fields returns no posts
  81. WP_Query get posts where post_name is empty
  82. Storing/querying custom date data
  83. Advanced search form with filters for custom taxonomies and custom fields
  84. Query recent posts by author
  85. 404 on Pages for Custom Post Type & Query_Posts
  86. Custom Post Type + Custom Meta Query Not Showing 2012 Posts
  87. Filter Custom post type by another Custom post type
  88. Show Posts in Vertical Tabs with Scrollbar
  89. How to show all posts of specific custom post type with their custom fields values?
  90. Display a list of posts whose meta field values are equal to the ID of the post being viewed?
  91. Check for custom field value in different post type than current one and do something
  92. querying to custom field over ACF REST API
  93. Display ACF object field data using Elementor Custom Query
  94. WordPress custom field sorting, weird behavior: the latest post is at the end
  95. Sort CPT by taxonomy AND THEN by custom field
  96. WP Query + custom fields: How to query event posts from the current date backwards 6 months and organize it month by month?
  97. Query order by a numeric ACF field
  98. WP_Query not using relation key as expected and not producing any results
  99. Quering a post object based on another related post object
  100. Use Custom Field to Display Post Loop
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
  • Post Navigation Elementor
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • WPFacet multiple loop displaying duplicate content
  • Get the name of the template/*html file used
  • Fix: WordPress.DB.PreparedSQL.NotPrepared Plugin Check (PCP)
  • Removing unnecessary CSS and JS code from wp_head()
  • hexagonal image gallery. Am I on the right track? [closed]
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
© 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