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

Add custom field information to source meta data

You will first need to add some metaboxes to your posts. This has been answered a lot, and there are many posts on the internet about is, such as this full guide.

After adding metaboxes, you can hook into the wp_head action hook and output your metadata. Here’s a simple piece of code that goes into your theme’s functions.php file:

add_action ( 'wp_head', 'add_my_metadata' );
function add_my_metadata() {
    if ( is_single() ) {
        ?><meta name="citation_title" content="<?php echo get_post_meta( get_the_ID(), 'meta_key_here', true ); ?>" /><?php
    }
}

Make sure that your theme has the wp_head() function inside its header.php file, so the action hook can actually print the above code.

Related Posts:

  1. Can I exclude a post by meta key using pre_get_posts function?
  2. Custom post meta field effect on the performance on the post
  3. How to get custom post meta using REST API
  4. Difference between meta keys with _ and without _ [duplicate]
  5. Orderby meta_value only returns posts that have existing meta_key
  6. What is the index [0] for on post meta fields?
  7. What is “meta_input” parameter in wp_insert_post() used for?
  8. How to enable revisions for post meta data?
  9. The “_encloseme” Meta-Key Conundrum
  10. Best way to programmatically remove a category/term from a post
  11. Using get_post_meta with new_to_publish
  12. Custom field metabox not showing in back-end
  13. So much data in postmeta
  14. Can I count the number of users matching a value in a multiple value key?
  15. When using add_post_meta and update_post_meta, is there any way to give the individual arrays keys?
  16. How to hide meta box values from custom fields list?
  17. Auto sort the wp-admin post list by a meta key
  18. get_post_meta() unserialize issue – returns boolean(false)
  19. What is the advantage of the wp_options design pattern?
  20. Storing meta fields multiple times OR once with multi dimensional array?
  21. Allow user to create instances of custom field
  22. display specific custom fields
  23. Is there a hook / action that is triggered when adding or removing a post thumbnail?
  24. Meta keywords and descriptions plugin for manually editing meta for each page/post
  25. passing argument to get_template_part() or a better way to code
  26. Is it possible to store arrays in a custom field?
  27. Get updated meta data after save_post hook
  28. Multiple meta values for same meta_key adding on “Preview Changes” hit but not on saving or updating post
  29. Save HTML formatted data to post meta using add_post_meta()
  30. importing data from non-wordpress mysql db
  31. Create meta boxes that don’t show in custom fields
  32. Transients vs CRON +Custom Fields: Caching Data Per Post
  33. Unable to save datetime custom meta field using update_post_meta() function
  34. Up/Down voting system for WordPress
  35. post meta data clearing on autosave
  36. Create custom field on post draft or publish?
  37. Display info from custom fields in all images’ HTML
  38. Ordering posts by anniversary using only day and month
  39. get_post_meta fields don’t show up on posts page
  40. Update meta values with AJAX
  41. How to break meta values into different items and avoid duplicates?
  42. copy attachments to another post type and change attachment url
  43. Cannot edit post meta fields with rest API
  44. ajax delete value from custom field array
  45. Save attachment custom fields on front end
  46. How to use pagination with get_post_meta
  47. Copying Custom Meta Values from existing post to a duplicate post
  48. Displaying Meta Box Image
  49. Add a post meta key and value only if it does not exist on the post
  50. Move value of one custom field to another
  51. Order posts according to user defined order for meta values?
  52. Displaying posts with only upcoming dates according their custom field date value
  53. Custom fields to save multiple values
  54. Custom fields: In what order are they saved into the DB?
  55. Function to change meta value in database for each post
  56. Get a post_id where meta_value equals something in a serialized meta_value field
  57. Get aggregate list of all custom fields for entire blog
  58. Transition from (classical) serialized custom meta field to (gutenberg) rest enabled meta
  59. Unable to show ACF’s Image Custom Field properly in Genesis Framework [closed]
  60. Custom field value based on other custom field values
  61. wp_handle_upload error “Specified file failed upload test” but still creates attachment?
  62. How to save a ToggleControl value in a meta field?
  63. Which is best in the following scenario : post_meta vs custom table vs parent/child posts
  64. Saving custom image meta fields
  65. Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
  66. How to display Meta Field Value?
  67. MySQL query to set wp_postmeta using term_taxonomy_id value
  68. How to Validate Post Meta type/extension (Video File Image File etc)
  69. Get all meta keys assigned to a post type
  70. using multiple meta_key and meta_value in query_posts
  71. Custom Meta Box not Saving in Posts with Gutenberg Editor
  72. Adding custom fields (post meta) before/during wp_insert_post()
  73. Combine multiple custom field values into single value
  74. How can I sort homepage by a meta value?
  75. Get specific custom field keys from a post and put into an array
  76. How do I use wp_query for WordPress search?
  77. Nav Menu – Add class based on meta keys
  78. How to query posts with certain custom meta data, and output Post data
  79. MySQL Query that looks for post with Custom Field, then changes Category
  80. ACF: How to get the full field name (meta_key) by a field key?
  81. How to wrap meta values seperated by comma in ? [closed]
  82. Bulk remove post meta
  83. How do i output images from URL’s added to the same custom field key
  84. Retrieving custom field as shortcode
  85. Colecting values from custom field checkboxes and displaying them in the post
  86. Build Array from Input Fields question
  87. custom field with links
  88. add multiple values (array) to post meta_input
  89. Order by a meta field in query loop
  90. How can i put a custom field inside this php
  91. Site uses wpdb to fetch meta_keys but just displays first meta_key from a page (the post uses the same meta_key “filmmaker” more than once)
  92. save all acf options in one meta_value [closed]
  93. How to add new Metadata options (Date, Author, etc.) for Posts?
  94. WP Query Args – search by meta_key or title
  95. Saving multiple custom meta box fields
  96. Search for meta_query does not return any result if combined with title
  97. get Custom field label (select/dropdown) on front end
  98. SQL query based on two different custom field values
  99. Block Editor – Meta values not saved, meta changes to empty array on update
  100. What is the best way to get a different post’s custom field/postmeta with js?
Categories custom-field Tags custom-field, post-meta, single, wp-blog-header.php
How to add custom field to wp_list_table
HTML code in WordPress menu description

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