What am i missing?
‘tag’ may be a valid argument for get_posts() via WP_Query, but requires the tag slug in that case. Try using ‘tag_id’ instead.
get_posts() apparently enables ‘category’, but expects the the ID, even though in WP_Query the same argument is ‘cat’ (vs. ‘category_name’, et al).
A little confusing, perhaps, altogether. I know it still confuses me.
https://codex.wordpress.org/Template_Tags/get_posts
https://codex.wordpress.org/Class_Reference/WP_Query#Parameters
Related Posts:
- How to disable WordPress from creating thumbnails?
- set_post_thumbnail_size vs add_image_size
- the_post_thumbnail responsive srcset not populating with custom image size
- Set custom name for generated thumbnails
- New image size version only for the Featured Image file
- wp_get_attachment_image_src always returns full-sized image
- Add Title Attribute to WordPress Image the_post_thumbnail
- Can WordPress crop only the post thumbnails?
- Query the post which have a thumbnail
- Autogenerated Thumbnail compression depending on size
- How to use images uploaded with custom implementation of thickbox like the_post_thumbnail() functionality
- How to display thumbnail + tags + title of a child page?
- Media thumbnail for custom post inside post content
- Thumbnail and Featured Image With Fixed Sizes?
- List category posts – Thumbnails are not displaying
- Why am I getting errors in product.thumbnails.php? [closed]
- Is there a way to change a post’s thumbnail image(s)?
- how i can increase Featured thumbnails size?
- How check that there is post thumbnail feature image or not on wordpress?
- Force WordPress to strip/remove EXIF/IPTC metadata when resizing thumbnails
- If I Regenerate Thumbnails, would WordPress delete the existing Thumbnails and replace them with ‘new copies’?
- Is it possible to nest get_previous_post()?
- How to get cropped thumbnail source for custom post type
- Get ID of featured image using “get_post_thumbnail_id(the_ID())” – without printing to screen?
- How to offset thumbnails to the center?
- Sidebar Thumbs Squished?
- Aligning the thumbnail image
- Post thumbnail not working after regenerate
- How do get post thumbnail into plugin?
- “Medium” size image displayed instead of “thumbnail” in only one post, other posts are fine
- How to create resized versions of images added with wp_insert_attachment
- get_post_thumbnail_id() Doesn’t return value [closed]
- How To Add and Display Category Image
- get_the_post_thumbnail(‘thumbnail-name’) always returns empty string
- Can’t get post thumbnail to display in foreach loop
- Show posts image attachments
- Thumbnail is showing outside its div instead of inside it
- get_post_thumbnail does not display thumbnail
- how can I call a posts featured image in any template?
- how to resize thumbnail image
- Different thumbnails for index and article page
- Tag,php – how to get it to display featured post image? [closed]
- Thumbnails not being generated for PDF files
- Thumbnail size problem Desktop vs Mobile site
- How do you code a featured image into an XML as a jpg link, instead of using a data-id number?
- How to change the format of thumbnails into wordpress theme?
- display div tag only if post has thumbnail
- Thumbnails are hard cropped not matter what
- Thumbnails regenerate wp_generate_attachment_metadata
- Featured image size always cropped bottom
- set_post_thumbnail() shows Unattached on backend under Media
- Allow ‘Set featured images’ to select multiple images
- Why wordpress doesn’t generate thumbnails?
- Force Regenerate Thumbnails Not Working
- Trouble Retrieving Thumbnail URL on Front-Page
- I would like my posts to pull my custom cropped thumbnail instead of creating its own thumbnail from Featured Image
- WordPress save thumbnail but don’t show it [closed]
- Automatic adding thumbnail to post
- Different thumbnail size than actual picture in post
- Where is the template from the_post_thumbnail()?
- Images thumbnail not cropping square
- Add class name to post thumbnail
- Delete original image – keep thumbnail?
- How to crop thumbnail height to auto with set width
- How can I display my featured image correctly inside my single posts?
- Featured image upload finished hook
- Generate thumbnail for images with the same size as thumbnails
- Display the first image from a post in RSS feed
- Filter For Featured Image
- add_image_size and add_filter(‘image_size_names_choose’, ‘my_custom_image_sizes’) not working with wordpress 3.5.2
- Delete all thumbnails for a post
- WordPress Uploader Editor shows broken image
- Can’t get image size set with set_post_thumbnail_size() function
- Show LightBox when clicking on featured image [closed]
- what is the difference between timthumb and post thumbnail?
- Else condition not working while using has_post_thumbnail
- Only Display Thumbnail if Larger Than
- Disable post thumbnails in Twenty Thirteen child theme
- How do I add a default thumbnail to elseif when no get_field(‘photos’), and no post thumbnail exists?
- Problem with showing featured image
- Admin – no Featured image choice in create new/page|post
- Easy way to update a single translation entry without having to translate
- Featured image not working
- Insert post’s category name into thumbnail string
- Thumbnails in ACF Query Results
- WordPress 4.4 responsive sometimes doesn’t work
- Dynamically determine the width and height of a image file to be cropped & uploaded AFTER form submission given fixed aspect ratio
- Attachment Image using wrong src?
- Make 1st Slide of PowerPoint file to be the Post thumbnail preview image
- Use Post Title as alt text for Featured Image
- WordPress default srcset with hard crop
- wp_get_attachment_metadata()[‘image_meta’] fetch WP metadata or EXIF?
- White Blank screen and issue to get thumbnail in
- Full width thumbnail
- Thumbnails not showing in blog
- Featured Image inserted through custom query, does not show up
- How to import linked images and make them featured -> automagically
- Thumbnail images
- Featured Image Thumbnail Sizing
- How to modify Media Library images DPI [ image quality down to make small in size ] [closed]