kernox / Mastodon-Share-for-WordPress

Wordpress plugin for Mastodon
GNU General Public License v3.0
12 stars 1 forks source link

Scheduled Posts not working #30

Closed vsatmydynipnet closed 6 years ago

vsatmydynipnet commented 6 years ago

Hi,

love your cool plugin and it works great if manually posting from the dashboard. Everything fine.

Problem comes up with scheduled posts. I have a few sites where scripts posts scheduled "future" posts with wp_insert_post. This works great and autopost to Facebook, Twitter happens fine too. Only Mastodon doesn't get posted. :-(

Any hint or help would be appreciated.

Greetings!

Letiteuf55 commented 6 years ago

same issue here

vsatmydynipnet commented 6 years ago

Found it, you must update_post_meta as below. then it works.

// set the thumbnail ; see main top; must be preuploaded!
set_post_thumbnail( $id, $cts_thumb_id );

// we add mastodon share settings
update_post_meta($id, 'mastoshare-toot', substr($content500,0,499));
$thumb_url = get_the_post_thumbnail_url($id);
if ( $thumb_url )
{
    $thumb_path = str_replace( get_site_url(), get_home_path(), $thumb_url );
    update_post_meta($id, 'mastoshare-toot-thumbnail', $thumb_path);
}
Letiteuf55 commented 6 years ago

Maybe @kernox can add this to the main code ?