I found where the problem was. The code was attached to the the_content
hook which runs after the thumbnail is generated.
Attached the code to post_thumbnail_html
and it works now.
Related Posts:
- How to update custom fields using the wp_insert_post() function?
- Get meta_id along with meta_key and meta_value
- How can merge two arrays values in one array and save in database
- Check if user already visited this post today
- Display all meta for a post?
- retrieve thumbnail from post ID of best selling product in category
- How to display multiple Post meta_key/meta_values by SQL query
- How to use multiple query with same meta key
- WordPress remove EXIF Data from specific Thumb
- How to update single value in multi dimensional Post Meta?
- How to use SRCSET with get_the_post_thumbnail()?
- Compare two meta key values against each other inside the get_posts array?
- How can update custom meta for all posts
- Additional image sizes are not being generated
- Use ajax to update_post_meta
- How to make thumbnail image fit into a div where image dimentions are completely different?
- how to increase custom post value by one most efficiently?
- Batch update a post meta field value of each post in Post Type
- How to Display Image Meta underneath EVERY image in EVERY post
- Change description on specific WooCommerce product status change
- How to restrict wp generate attachment metadata() to certain intermediate image sizes
- combine Code 1 with Code 2
- Get Current User Id Inside a Loop Returns 0 For a Shortcode
- The text box have space character
- how to remove metadata from the posts of my blog?
- How can I create a list of page titles from custom meta values?
- Randomly Assign an Image’s Alt Text Based on Data From Post
- Advanced Meta Query for Large Calendar Website (12k+ posts) (175k+ wp_postmeta rows)
- Sort custom meta column by other meta value
- 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?)
- Creating user status mode in WordPress
- Need help with Google drive API [closed]
- How to use thumbnail size of image if I’m only using src to get image
- Archive post by meta value + 24hours
- Thumbnails appear to be zoomed
- ‘Post-thumbnails’ feature does not seem to register
- Is it possible to retrieve all posts with a certain value for metadata?
- Get post id within comments loop
- Querying Database with wpdb
- update_post_meta only updating on last loop of foreach
- How to use two meta_compare in an array?
- Custom Post type slider with thumbnail navigation
- Remove empty terms from array, sort alphabetically, update back to repeating field
- WordPress loop by meta key that is an array? and how loop multiple arrays
- WordPress yoast seo plugin – parse snippet var in meta description
- How to store multiple custom meta box
- How to add post meta in while loop?
- Add category to post meta
- Using rules in Posts
- Else/If Statement to Display Photo Descriptions
- Update post meta – Custom field does not match meta-key
- Order a WP_Query by meta value where the value is an array
- Save the value of a wp_dropdown_pages
- Add a custom class to the body tag using custom fields
- Define category ID using get_post_meta
- Unable to Call More than One Meta Box Output
- Hide a div when a custom field is empty
- Setting a default thumbnail url if no thumbnail
- Update value of a associative array with update_post_meta
- Front end file upload returning wrong attachment url
- Post meta select input, if statement
- WordPress stripping out custom field tags
- get value from get_post_meta then reuse it in another get_post_meta
- Order category posts by last word of custom field
- Loop for recently (updated_post_meta) posts?
- How to update custom fields when post is published?
- Update Images after edit via php
- No more get_option(‘date_time’) in WordPress 5.5?
- Delete post meta by serialized meta value
- Using zip code to display custom data in Admin Order Details
- Show a text if the post has written by author user role in WordPress
- Hide author from search results meta, still display date and categories
- Fix common misspellings/errors based on array of replacements
- update_post_meta Not Processing Array Data (Not Sure What I Am Missing)
- Unable to update the meta boxes with multiple fields
- WP post meta – for loop inside for loop
- Reverse Cross-Sells (WooCommerce)
- Remove item from post_meta array via AJAX
- When working with a post, almost all wp_postmeta are deleted
- Post Meta statement?
- Adding user meta to post meta wp_insert_post() not working
- Showing wordpress latest post thumbnails in slider with auto increment
- Efficient way of querying for a “fallback” post?
- WordPress AJAX load post metadata in modal
- get_post_meta with variable
- Post from front end form to post_meta
- Order by in foreach
- retrieve wordpress post-meta using php not wordpress functions
- Postmeta not saving
- If custom field doesn’t exist, or exists and it’s true show title?
- get_post_meta is always empty when I use wp_mail
- get_post_meta no longer working
- How to add together (get the sum) a field from all author’s posts
- PHP-Code inside Href-Tag
- Metadata on the WP_Post object
- How to display the date under the post title?
- How can i give a download link to the thumbnail or featured image
- How do I get a function to work in single.php
- How to modify default tags in wp_head()