In WordPress attachments are treated as posts, with their own titles, excerpts and metavalues. So if a post has an attachment there are two sets of metavalues, one for the post itself and one for the attachment.
You are using update_post_meta( $post['ID'] ...
to store the url. So it is stored as a metavalue of the post.
You are retrieving with get_post_meta(get_post_thumbnail_id() ...
, so you are looking for a metavalue of the attachment. To retrieve it you must not use get_post_thumbnail_id()
but $post['ID']
, because that’s where you stored that url.
Related Posts:
- add_image_size() for specific Post Types
- How to disable generation of default image sizes for some custom post types?
- set_post_thumbnail_size in percent, not pixels?
- How to add multiple featured image in meta box in post editor?
- add_image_size for post type
- Change post featured image on hover
- Custom Image Thumbnails of Different Sizes
- Link to full size post thumbnail
- Multiple featured sizes / images / excerpts
- How can i add thumbnails images to particular post (using code not admin pannel) in wordpress
- How to Create an Image Upload Box for Custom Posts?
- Redirect to another page using contact form 7? [closed]
- Is it possible to add posts and images (auto resize) for custom post types with a script?
- Using Image Sizes for Custom Post Types outside the Loop
- Thumbnails Not Generating
- Customized featured image doesn’t refresh in post admin metabox after upload/insert
- img src not working correctly in custom post type
- Front end post or photo or both
- set_post_thumbnail or media_sideload_image adds image multiple times in media library
- How to Create Grey Background for Product Images on Website Display but Retain White Background on Downloaded JPGs?
- How to check if user meta field is empty in conditional else statement
- Custom Post Type with Templates using Meta Boxes?
- How to set YouTube video as featured image?
- uploading images to specified directories
- Get image post ID in media upload
- Why is my select meta data not saving?
- WordPress 3.5 Media Uploader – Only allow 1 upload and certain file types
- Add Standard Page Attributes Metabox for Page Parent
- Hide editor while keeping add media button in custom post type
- dynamically add a custom field or metabox to custom post type [duplicate]
- Custom Post Type with image gallery
- Make metabox of custom post type fully autosave- and bulk-/quick-edit compatible
- Custom Post Type uses Custom Tags in add_filter?
- Post Quote with image on header for news site
- Custom Post Types, URL rewrite on multiple CPTs
- Custom date changer post_date => future – missed schedule error
- How to store multiple values in 1 meta_key with radio input?
- What is the best way to correlate one-to-many content-type relationships?
- Is it possible to create relational metabox values in a custom post?
- Get Taxonomy Term Title by it’s URL
- can I chage url for register_post_type
- Changing custom type name hides the posts
- How to add a post slug to a url?
- URLs for child terms
- Front custom edit post page for each post
- Add custom image size for custom post type or taxonomy
- Visual editor issue by having multiple tiny mce editors in a CPT
- How to build custom route by adding taxonomies to URL ? ex: www.demo.com/communities/palo-alto/
- Remove the parent slug in a CPT URL
- Found 2 elements with non-unique id (#_ajax_nonce) and (#_wpnonce)
- A better way to add a meta box to custom post types
- create a subcatagory for a custom post type and out put url as posttype/subcategory/item
- Rewrite Question Mark in Post Template to Make it Pretty URL
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- How to automatically set ‘default image size’ for specific Custom Post Type
- Plugin – Combine Meta Box Input Fields into single saveble record
- Getting Custom Post Type Meta on Publish
- Changing the search url according to language
- Meta Query Filtering not working on Custom Meta Box using Radio Buttons
- How to Upload CSV Data into Custom Post Type Data with Metabox programmatically
- Grouping metadatas into one
- Anon function and add_meta_box
- Metabox not show in categories custom post type cmb2
- Repeatable Fields Metabox with Textarea (or wp_editor)
- How to use TinyMCE Editor for one of my custom post meta field?
- Display correctly using metabox.io
- WordPress randomly shows 404 errors
- Create Connection Between two post types
- Problem: wp_query outputs all images on site
- pre_get_posts for custom page builder meta box
- Disable closing on metaboxes
- unable to show custom post type featured image
- Show Custom Post Type meta boxes only on Page Edit
- Cannot save CPT meta box
- non-hierarchical post type with hierarchical url structure
- How to make custom taxonomy into drop down select in a custom metabox
- Adding Page Templates to post but it ignored it
- Parent Page and Breadcrumb URL’s for Custom Post Types Not Working
- Problems with image size on the server WordPress
- Create a Dropdown from Custom Post Type
- Translating custom post type metaboxes [closed]
- Adding a metabox on a CPT’s submenu page
- Fixed values for same post translations
- How to Add multiple instance of meta box to custom post type
- frontend image post uploader
- Using POST method in meta box, no results
- meta box on custom post type
- Adding custom image sizes and post types to a plugin or to a theme?
- Checking if $_FILE isset for an array of file upload metaboxes
- Taxonomy in URL
- Ordering values entered in Custom Taxonomies
- Listing custom terms in custom post meta
- Permalinks: custom structure for taxonomy – tags?
- How do you create a custom template to display a category with an image and related posts below?
- Custom Post Type & Meta Box – Displaying meta box information on front end?
- Best structure / rewrite rules to achieve the following url
- How can I move (or create another) publish button?
- Wrap meta boxes & data handling for specific post types in classes?
- How to handle large number of images in a post?
- Can custom fields be added without a meta box?