Public method fpwCategoryThumbnails::addThumbnailToPost | FPW Category Thumbnails - Documentation | Support



Please consider registering

sp_LogInOut Log In

Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 4 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Public method fpwCategoryThumbnails::addThumbnailToPost
sp_TopicStatus Status: Final

Since version 1.4.9 the public method fpwCategoryThumbnails::addThumbnailToPost is available to plugins developers in both back and front end. There are three ways to add a post thumbnail to a post:

  1. manual - assignment of the Featured Image to the post while adding or modifying through admin user interface
  2. automatic - while the post is being created or modified - Add New Post or Edit Post admin screens
  3. pressing Apply Mapping button of plugin's settings page

However, there are cases when a post is being created / modified outside of the admin user interface. In such cases the assignment of a thumbnail does not occur. The following example shows how to assign or change post thumbnail in one of this cases.

$myPost = array(

    // all neccessary post's elements


$post_id = wp_insert_post( $myPost );  // create or modify a post bypassing 'save_post' action

// check if post is ceated / modified and the method exists

if ( $post_id && method_exists( 'fpwCategoryThumbnails', 'addThumbnailToPost' ) ) {

    $post = get_post( $post_id );

    // thumbnail assignment

    fpwCategoryThumbnails::addThumbnailToPost( $post_id, $post );


Forum Timezone: America/Edmonton

Most Users Ever Online: 8

Currently Online:
1 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Member Stats:

Guest Posters: 2

Members: 1

Moderators: 0

Admins: 1

Forum Stats:

Groups: 1

Forums: 5

Topics: 6

Posts: 10