get_the_post_thumbnail() returns the entire img tag, not just the image URL.
global $post;
return get_the_post_thumbnail( $post->ID );
You can also use function wp_get_attachment_url() or wp_get_attachment_thumb_url() to get image URL and insert it into the img tag.
global $post;
$thumbnail_id = get_post_thumbnail_id( $post->ID );
if ( false === $thumbnail_id )
return '';
$img_url = wp_get_attachment_url( $thumbnail_id );
return '<img src="' . $img_url . '" />';
Related Posts:
- Redirect to another page using contact form 7? [closed]
- Autogenerate wordpress shortcodes using array?
- Shortcode display outside the div
- Shortcode under a Shortcode Multiple times Possible?
- Disabling post images for not logged in users
- Converting a simple plugin to be placed inside of functions.php
- Layout shop page: resize images and columns
- bulk change of image setting “link to” to “link to: image url “
- Trying to count the total number of paragraphs inside a blog article
- May i Use ShortCode in Template?
- Prevent shortcode from being wrapped in tags
- Inserting HTML tag with ACF into shortcode
- Adding Shortcode to Text Widget
- Snippets: is it better to add them in functions.php or make site-specific plugins?
- creating html reusable blocks via shortcodes
- Nested shortcode functions accessing variable
- Calling an attribute from a plugin shortcode
- What is @Action in WordPress?
- Image change on hover
- Return multiple values in a shortcode attribute
- Shortcode Attributes to Return different $_POST
- strange shortcode error: does shortcodes requires any dependency?
- Get Image Having the ID [closed]
- Add the_post_thumbnail_url to a shortcode in function.php
- Adding a Tag Parameter / Filter to My Shortcode
- Add_image_size not generating correct size
- grab or load text on demand
- How to get current cart values using WC_Shortcodes?
- insert og image link in wordpress post
- Get Shortcode output to database for static post_content
- How to wrap image tag into div for post only?
- Find all strings between an enclosing shortcode
- wordpress Shortocode running twice?
- Posting code inside the post instead of in the template file using shortcode
- Integrate Razorpay quick payments plugin with contact form7 plugin
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode
- How to get next day date of a specific day
- How to include a plugin’s php file to another plugin functions file [duplicate]
- How to assign user a role if none is present when logging in
- resize only height using wp_get_image_editor
- How to add inline css/js inside a shortcode
- How to crop image from center using wp_image_editor
- How to find out what blocks are added by a plugin
- How extend shortcode default values for a plugin?
- Shortcode in AJAX popup
- Converting Attachment to Images?
- Bulk Image Uploader to create new post from each image [closed]
- How to add a random image to a post from gallery and only show one?
- Dropdown menu on custom page with product to choose number of products per page
- How to append to title via functions.php for auto-posting plugin [duplicate]
- Bootstrap Drop Down menu is not working
- tag breaks shortcode output (other solutions don’t work)
- Allow users of my plugin to define their own shortcode rather than use mine?
- Set featured image randomly from WordPress Database on post submission
- How to change constants in WordPress wp-config.php programmatically?
- Override Plugin Script Fucnction in WordPress
- add_shortcode is not working in plugin where others are working
- How to call WordPress function other files
- How to upload WordPress Images to remote web server and display those images in WordPress gallery [closed]
- Some code in shortcode function being ignored
- Use $_GET inside a shortcode print empty Array
- Slider/text combination plugin
- How to add a dvi tag to a shortcode then change a generated text using jQuery
- Are there action hooks for comments?
- Plugin onclick button activate other plugin
- Activate and deactivate plugin automatically
- How to get images using taxonomy ( WP Media Folder)
- adding Adsense’s In-Article Ads between images of blog post
- Get param from shortcode in plugin function
- WordPress function to add text warning on every pages [closed]
- Inserting shortcode in href – any ideas or workarounds?
- Load CSS files in header of Bones theme?
- Call javascript functions from each page
- Can export gallery but can’t import it Wp all import
- Create a pdf from the entries in DB
- RSS feeds for specific topics
- Overriding a function in a WordPress plugin
- Display Multiple Photos as Featured Image when mouse moves on to it post
- Issue Saving Posts That Contain Shortcode
- Use buddypress function outside of plugin
- Using Shortcode Result In Custom HTML Block (Using Google Sheet JQuery Result As NumScroller data-max)
- WPML – Hook when language is switched (change user language)
- Use action, filter, or hook to append HTML to WordPress plugin function
- Save Post Permalink In .txt File
- Does WordPress have a way of changing the ‘Natural’ size of uploaded images?
- Disqus comments count taking long to update
- plugin not hooking to my custom hook
- Multiple level shortcodes
- how to open image gallery in a post/page?
- Is it right way to create shortcode?
- Determine if get_the_image has image on Get the image Plugin
- Trying to override/intercept a PhotoMosaic gallery link in WordPress using jQuery
- Trying to output a “Most visited blogs” list in wordpress multisite
- How should I force WordPress to give proper name for the uploading images?
- Want to show pop up image on home page every time when i refresh it [closed]
- How can I get the permalink of a page on which shortcode has been used
- Show WooCommerce products based on query parameters on redirect
- Secure way to add JS Script to WordPress filesystem
- WP galleries in posts after import. How do I do it?
- How to access a function declared in child theme’s functions file in a plugin file?