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_post_meta in a shortcode in excerpt on archive pages

The do_shortcode function runs on the the_content hook:

402   
403   add_filter('the_content', 'do_shortcode', 11); // AFTER wpautop()

https://core.trac.wordpress.org/browser/tags/4.1.1/src/wp-includes/shortcodes.php#L403

So, without seeing your theme code I am going to guess that your theme’s archive page is written in such a way that the do_shortcode function does not fire– possibly because it uses the_excerpt instead of the_content. If that is the case, you can force the processing of shortcodes with:

add_filter('the_excerpt', 'do_shortcode');

However, you will need to watch that as some shortcodes may generate content that you don’t want in the excerpts.

Related Posts:

  1. do_shortcode based on _thumbnail_id
  2. Meta tags in shortcode
  3. Display post metadata: “title, category, author, date” with shortcode
  4. Shortcode to show current post category with link
  5. update_metadata() appends shortcode data for every page refresh
  6. Plugin Shortcode value in post
  7. Display post_meta in Shortcode
  8. Applying if (get_post_meta) to new shortcode
  9. add a meta value to the shortcode twice
  10. convert it into short code & explan how? [closed]
  11. Enqueue Scripts / Styles when shortcode is present
  12. Conditionally Loading JavaScript/CSS for Shortcodes
  13. What does extract( shortcode_atts( array( do?
  14. How do I escape a ‘]’ in a short code?
  15. Pass boolean value in shortcode
  16. Show shortcode without executing it
  17. Shortcode always displaying at the top of the page
  18. Redirect function inside a Shortcode
  19. How to create a shortcode with 1 parameter (atts)
  20. how to show the syntax of a shortcode
  21. Custom shortcode being executed when saving page in wp-admin
  22. Change appearance of shortcode text inside editor
  23. current_shortcode() – detect currently used shortcode
  24. shortcodes output before content [duplicate]
  25. WordPress plugin shortcode not working
  26. How to add stylesheets only to pages with specific shortcode?
  27. Using get_option() in JavaScript
  28. Shortcode empty attribute
  29. How does a shortcode work?
  30. Shortcode outputs at the top of the_content
  31. the_excerpt and shortcodes
  32. Using wp_editor in shortcode
  33. Remove wpautop from shortcode content / remove whitespace in buffering
  34. Get current post id witout passing in shortcode
  35. Why are you using add_action for shortcode?
  36. How to get URL param to shortcode?
  37. How to add multiple buttons to TinyMCE?
  38. Check if post/page has gallery?
  39. Get first video from the post (both embed and video shortcodes)
  40. Get shortcode name from within it’s callback function? [duplicate]
  41. Wordspress add into my javascripts
  42. Making a Shortcode [NEXT] and [PREVIOUS] to place into specific posts for post navigation
  43. How do I create a Shortcode that returns text if domain is .com, not .co.uk
  44. Using preg_replace to separate gallery from the_content?
  45. Remove specific shortcode from get_the_content()
  46. How to display the site name in a WordPress page, or post
  47. Hide/show content starting in the middle of a paragraph
  48. Combining shortcode and get_template_part
  49. How can I put a wp_redirect into a shortcode?
  50. Escaping quotes from shortcode attributes
  51. Run visual composer code in php page
  52. short code output too early
  53. Shortcode in shortcode: How to append variable?
  54. Remove wptexturize from a shortcode?
  55. How can i put an array as variable in shortcode_atts?
  56. Autoembeds don’t work with paragraphs
  57. Table of Contents with a shortcode
  58. Create custom [sourcecode] shortcode, the right way?
  59. TED talks shortcode not working
  60. Allowing shortcodes inside attributes
  61. What is the best way to enable nested shortcodes?
  62. Tinymce – How to hook before or after live shortcodes rendering?
  63. How to customize a shortcode using the customizer
  64. Native “playlist” shortcode random playing… How?
  65. How to Output HTML tags in do_shortcode?
  66. List of all inbuilt WordPress shortcodes
  67. Nested Shortcode Detection
  68. Shortcode output always showing at top of page
  69. Organizing shortcodes. How to display all of them and their attributes?
  70. How to detect if a Shortcode is being called on a page?
  71. How to get current page title inside a page itself in a shortcode and in page content
  72. how to have the gallery shortcode output one single UL list instead of several DL?
  73. Implement If-ElseIf-Else-EndIf with short codes
  74. Short code to display a loop
  75. Using shortcode in Post title
  76. using html as shortcode attribute
  77. shortcode outputs first before the page content [duplicate]
  78. How to add ‘class’ attribute into shortcode [audio]?
  79. Make shortcode work with nested double quotes
  80. Get all posts containing a shortcode
  81. How to display the names of users from a specific group with a shortcode?
  82. WordPress adds br in between my shortcode
  83. Stray closing paragraph tag when using shortcodes
  84. How to display html in a shortcode
  85. Update all posts automatically when using post_meta
  86. Can I strip HTML tags in the “Compare Revisions” screen?
  87. Custom form, shortcode, and submit handler
  88. shortcode inside another shortcode
  89. Automatically add this attribute to the gallery shortcode
  90. WordPress transients for a shortcode
  91. Are php template shortcodes ok?
  92. Extract attribute values from every shortcode in post
  93. How to make shortcode to hide selection of text from post or page?
  94. Get post id shortcode
  95. how to get shortcodes to work inside the text of custom fields
  96. Shortcode attribute value with dash (hyphen)
  97. Set wmode attribute to transparent for the embed shortcode to make drop-down menu hover over YouTube embed in Internet Explorer
  98. Using action hooks inside of a shortcode
  99. How can I just get content inside a shortcode or just outside
  100. how do you get the author’s username?
Categories shortcode Tags post-meta, shortcode
Using init hook for register_taxonomy is causing invalid_taxonomy in wp_insert_term()
How to make the Pages in WordPress Customized?

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