The first argument for that function is not size. See the documentation (if a function’s not working, checking the documentation should always be your first step):
get_the_post_thumbnail_url( int|WP_Post $post = null, string|array $size="post-thumbnail" )
The first argument is which post the get the URL for, while the size is the second argument.
To avoid redundancy, when you’re in the loop, set the first argument to null
to get the current post:
<?php echo get_the_post_thumbnail_url( null, 'full' ); ?>
But honestly, you shouldn’t be using this function this way. If you want to output the post thumbnail, use the the_post_thumbnail()
function. That way you automatically get the image’s alt
text, width
and height
attributes, as well as srcset
and sizes:
<a href="<?php the_permalink(); ?>" class="height300 bg-graylight flex-center c-dark position-relative">
<?php the_post_thumbnail( 'full' ); ?>
</a>
Related Posts:
- How can i place Feature Image under title field in wp-admin?
- Show Post Thumbnail In Custom Post From Other CPT
- Featured Images does not show in custom post type
- how to post default thumbnail if post not created yet
- Dynamic pages for linked categories and content
- Using Image Sizes for Custom Post Types outside the Loop
- Cannot upload featured image to a custom post type
- How to add Support to show Fullwidth Featured Image of Custom Post Types in WordPress.?
- How come Featured Image isn’t showing up in my Custom Post Type?
- Use register_post_type() to modify an existing post type
- add_image_size() for specific Post Types
- How to disable generation of default image sizes for some custom post types?
- Custom user role cannot see or modify featured image
- Get list of all registered post types slugs
- How to remove “featured image” functionality from a custom post type?
- Featured Image Panel Missing From Custom Post Type in WordPress 3.2
- WP_Query ignores post_type in category view
- How to get only posts, pages and custom post types in WordPress
- Best way to filter featured image text for a custom post type?
- If featured image doesn’t exist, show post content
- Better to use a post type archive, page template, or shortcode for generating a highly configurable CPT archive?
- set and unset the custom field value
- Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy
- Featured image metabox not showing up
- image srcset returns false
- How to use different featured image size for a custom post type?
- Change admin post thumbnail size for custom post type only
- reference the current category being used in the category.php page
- Gutenberg Featured-Image-panel missing when user with custom role edits Custom Post Type
- Change post featured image on hover
- How to retrieve a custom post’s capability?
- Use get_post_types to query only custom posts types
- is there a way to retrieve posts that do not have a featured image assigned?
- WP_Query | ‘post_type’ doesn’t work
- Using global $post; to get featured image for custom post via WP_Query
- Displaying media for custom post type
- Custom Image Thumbnails of Different Sizes
- How to change post featured image using a custom field of category?
- Change Featured Image / Thumbnail CMS Description
- Is it possible to show full content of the post when there is only one post in a grid?
- child of post type (custom)
- 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
- Custom Post Type And “fopen”
- How do I set default meta value by post type?
- Limit amount of posts made within a custom taxonomy
- unable to show custom post type featured image
- How do you create a custom template to display a category with an image and related posts below?
- Is it possible to filter the display name for post formats for display in the Formats meta box?
- Set featured image to archive.php
- Unable to set featured image
- How to Set Taxonomy Object Description?
- Show only public custom posts in home page
- Post-thumbnail only for specific post-types?
- Featured image size in column
- post_parent in custom post type
- Custom filter for main search: how to exclude specific post_type from search results
- 3 random images from custom post type, each in a div with a diffrent class
- Is it possible to add posts and images (auto resize) for custom post types with a script?
- get_post_types – exclude multiple post types by name
- Remove taxonomies using register_post_type_args
- Custom post type and standard post not displaying or working
- Custom post type in theme not appearing
- How to copy a custom field from the user’s CPT to the user’s normal posts
- Add filter to Admin list for all custom post types by their custom taxonomies
- Thumbnails Not Generating
- Add Permalink to Post Thumbnail, syntax code issues
- Need help with simple “if statement” checks to output particlular CPT data depending on what client uploads/fills out
- How to hide list from custom post type
- Put featured image under post title in admin area
- Custom Post Type Single Page is not working
- custom post type single page not found after aotumatic publish By the author’s robot
- In the admin, how can you list thumbnails instead of titles for a custom post type?
- How to mix 2 kinds of post types
- Change Custom Post Type to Post + Category
- Shortcode in excerpt
- How can i order my posts by post type?
- Permanent Custom Post Type
- Display featured images from custom post type in the homepage template
- How to set a default CPT template and create post attribute´s display rules?
- Post types showing tables…Can I do that?
- why featured image option isn’t showing in custom post type?
- custom post permalink
- Add featured image programatically to custom post type
- retrieve custom post image through widget
- How To Loop Through list with Custom Post Types
- do action inside a class is not working
- Updated from 3.8 to 4.2 and all post types changed to “post”
- How to scroll through post thumbnails?
- How would I get a list of posts from a custom post type
- Featured image in admin on custom post type
- How can I make a custom post type that loops pages in a new dashboard page, each single page is a new dashboard page (all within the back-end)?
- Link to larger thumbnail in custom query (with custom post-types)
- How to add post type in masonry posts elementory widget
- Quering array of post types & pagination. Articles are repeating sometimes on different pages
- set_post_thumbnail or media_sideload_image adds image multiple times in media library
- custom taxonomy not return in the code
- Custom post type REST api 404: Updating failed. No route was found matching the URL and request method
- How to Create Grey Background for Product Images on Website Display but Retain White Background on Downloaded JPGs?