tao-software / tao-schedule-update

Wordpress Plugin to Schedule Content Updates
https://wordpress.org/plugins/tao-schedule-update/
MIT License
16 stars 14 forks source link

Doesn't copy post Parent #26

Open lucidlyle opened 6 years ago

lucidlyle commented 6 years ago

When I create a scheduled update, it makes the post parent itself, resulting in a permalink that looks something like "http://website.com/post-name/post-name/", rather than the current post parent (or no parent at all). This is creating an issue where WP defaults the URL to "http://website.com/post-name/" when trying to preview the page, which obviously shows the original pre-updated version.

I was able to fix this by doing the following:

adding

$orig_id = get_post_meta( $original, self::$_tao_publish_status . '_original', true ); $orig = get_post( $original );

to the "create_publishing_post" function (around line 528 of the tao-shedule-update.php file) and then setting the post_parent like so:

'post_parent' => $orig->post_parent,

Thanks

Syberspace commented 6 years ago

Does the redirect to http://website.com/post-name/ also happen when you are logged in? If so you might want to activate the option for Scheduled posts are visible for anonymous users in the frontend in Settings -> Scheduled Update.

Otherwise anyone not logged in to the wordpress backend cannot view the scheduled updates.

lucidlyle commented 6 years ago

@Syberspace Thanks for your reply. In response, we are only using this when logged in, we don't want other users to be able to see the updates, so if this option is going to make this URL visitable by anyone then it wouldn't work for us. Surely if I, an admin user and the creator of the scheduled post whilst being logged in, wanted to preview the post, I wouldn't need to have this option selected?