-
-
Save gaambo/f25d6b25c417cb622c929f984e608a5f to your computer and use it in GitHub Desktop.
WP Revisionary Preview Wrong Thumbnail Image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function fltPreviewLink($url, $_post = false) { | |
global $post, $revisionary; | |
if (!empty($_REQUEST['wp-preview']) && !empty($_post) && !empty($revisionary->last_autosave_id[$_post->ID])) { | |
$url = remove_query_arg('_thumbnail_id', $url); | |
// EDIT: get thumbnail id instead of setting thumbnail id to autosave post id | |
$thumbnailId = get_post_meta($revisionary->last_autosave_id[$_post->ID], '_thumbnail_id', true); | |
$url = add_query_arg('_thumbnail_id', $thumbnailId, $url); | |
} elseif ($post && rvy_is_revision_status($post->post_status)) { | |
$url = rvy_preview_url($post); | |
} | |
return $url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment