You are most probably using add_theme_support()
in the wrong context (hook).
Because you are registering the post type yourself, all you need to do is to add support for thumbnails in the supports
array when you pass your your arguments to register_post_type()
supports
(array/boolean) (optional) An alias for calling
add_post_type_support()
directly. As of 3.5, boolean false can be passed as value instead of an array to prevent default (title and editor) behavior.Default: title and editor
All you need to do is to pass thumbnail
to the array
'supports' => ['title', 'editor', 'thumbnail'], // Add additional values as needed
You would also need to check if support for thumbnails is enabled by the theme, and if not, add post thumbnail support in your plugin.
Related Posts:
- How to change the case of all post titles to “Title Case”
- How to detect single.php (but not single-portfolio.php)?
- Function to execute when a post is moved to trash .
- Changing the post date and time with function
- Get current post id in functions.php
- Dynamically add id to heading tags
- disable WP automatically inserted line breaks after an image
- Getting the post_id in wp_ajax function
- Fatal error: Call to undefined function post_exists()
- How to publish a post with empty title and empty content?
- delete post also attachments
- How to call function within a page/post, to dynamically generate content?
- Restrict users from editing post based on the age of the post
- How do I use element instead of tags in WordPress post content having webP support?
- Code to auto expire posts after 30 days
- List only child categories a post is in, of a specific parent category
- Keep a fluid max number of posts on site
- How to change post status from publish to draft using hook in wordpress?
- Guest Author – How to modify my custom function code if the guest author URL will follow a particular pattern/format?
- Custom colors for post rows based on post meta value
- How to add an admin function only to posts, not pages?
- Human Time Diff, change mins to minutes
- How to get new post URL?
- Force update all posts in custom post type, no content changes
- Custom wp_trim_words() function not trimming right
- Disable REST API for a user ROLE
- How to display post tags
- How to Display Post View Count
- Remove double space after a period
- Add confirmation popup on “Move to Trash”
- Allow role to delete posts but block him the wp-admin
- Why does `url_to_postid` return 0 when testing `page_for_posts` Page?
- WP_Query in functions.php overrides global $post object, even with wp_reset_query()
- Delete Post From Front-End and attachment permanently
- Limit function to specific post category
- $post object is null
- When paginating a Page with the tag, how can the 2nd and subsequent page styles be customised?
- Function to show random posts from a category
- How to change the page break URL from ../post/2 to …/post/page2/
- Hiding posts in a list from specified categories
- How can I list random authors from current post category?
- Disable single post page
- Run a function when post is deleted?
- Checking is user author of number of posts?
- Create cron job without a plugin?
- Getting current post ID in functions.php
- How to rename “Publish” metabox title in post screen
- Action hook for new pending posts?
- Uppercase first sentence in every post
- Add icon/badge next to posttitle of specific category
- Ajax posts filter by date, comments, top views, top likes
- Prepend or add an Image to the content of a Post
- Converting a dynamic piece of code using WordPress Loop into a static one using Post ID
- Why content_arr[‘extended’] removes paragraph tags?
- Load post attached images on a single page site with fancybox
- Exclude category from
- Setting posts_per_page for taxonomy term template
- Change post order random through out the entire WordPress
- How to display the link (title) and thumbnail post?
- Force the “Choose from the most used tags” meta box section to always be expanded
- Show the content that is after the excerpt using child theme
- How to allow users to post only in certain category and hide elements from edit page?
- How to do set post permalinks using 6 digit random unique function?
- Can’t get buddypress notifications in front-end; why do I get this error?
- How do I display some posts fully on the homepage, and some as an excerpt only?
- Send post id through ajax and get the post content back
- Display post x of y within category
- Force authors to Preview a post before publishing
- WordPress Automatic Filename Changer
- Order posts alphabetically: how to set order=asc in mysql query?
- Change all author links in Blog roll
- disable Tab post on nav-menus page (Admin)
- Adding bootstrap classes to video shortcodes
- Every second post different class in blog view
- Format latest/newest post differently
- is_page Funtion for Posts ?
- Post type no single page
- Get post meta retrieving wrong value
- Adding a user’s ID behind the tag ref link address
- The_excerpt() doesn’t parse – how to change that?
- How to only publish posts with image in it
- Isn’t the way posts are displayed very unefficient?
- Add custom text automatically on each post
- How to check in functions.php if there is data in a WP_Query?
- restrict incrementation of post vies count when refreshing the page
- Defined function isn’t showed on page
- Insert Shortcode exactly at the end of the content
- Ajax calls in wordpress
- display last post modified date in genesis child themes
- What function does the loop of displaying posts?
- Custom Post-Rename Function Does Not Function in WordPress 6.x
- Show Next/Previous without Link
- Filters do not work when there are multiple (one works)
- How to use shortcode to get the second to newest post?
- How to sort posts alphabetically based on a specific parent category
- Send post to remote wp site from post edit window with all data excerpt image
- WordPress current post functions inside loop doesn’t work anymore, are they incompatible with php 8.0?
- How can I strip a single tag from an email post
- Parameter for pagination posts_pagination
- Add function to single blog post pages only