Issue with scheduled posts
-
Hi,
It seems that there is a problem with Plugin Organizer and scheduled posts.
When a scheduled post is published, “transition_post_status” hook is fired and your function “update_post_status” updates the post status in “po_plugins” table.
But it does not update “permalink”, “permalink_hash” (and “permalink_hash_args” ?) which are modified when the post status changes from future to published.
Then, as “permalink_hash” is not up to date, the post is not found and plugin exclusions are not applied.On the opposite, when we change manually the post status on the post meta box, everything is fine.
Here is what I did to fix/hack this on my functions.php file.
There surely might be better solutions but it seems to work…global $PluginOrganizer;
if ($PluginOrganizer) {
remove_filter( ‘transition_post_status’, array($PluginOrganizer, ‘update_post_status’) );
function my_update_post_status($newStatus, $oldStatus, $post) {
global $wpdb;
$permalink = get_permalink($post);
$permalink = preg_replace(‘/^.{1,5}:\/\//’, ”, $permalink);
$permalinkNoArgs = preg_replace(‘/\?.*$/’, ”, $permalink);
$wpdb->update($wpdb->prefix.”po_plugins”, array(“status”=>$newStatus,”permalink”=>$permalink, “permalink_hash”=>md5($permalinkNoArgs), “permalink_hash_args”=>md5($permalink)), array(“post_id”=>$post->ID));
}
add_filter(‘transition_post_status’, ‘my_update_post_status’, 10, 3);
}It would be great if you could fix this directly in the plugin.
Thanks.
- The topic ‘Issue with scheduled posts’ is closed to new replies.