-
-
Notifications
You must be signed in to change notification settings - Fork 513
TimberPost picks up the wrong post ID in preview mode #1318
Copy link
Copy link
Closed
Labels
Description
Steps to reproduce behavior
- Publish a post in the admin
global $post->ID === 1new TimberPost()->ID === 1- Make change in post
- Click "Preview Changes" button
global $post->ID === 1new TimberPost()->ID === 2<-- mismatch
Expected behavior
new TimberPost()->ID should be the same as global $post; $post->ID, which is the original post's ID
Actual behavior
new TimberPost()->ID is the revision/preview ID, not the original post's ID.
This causes new TimberPost()->thumbnail() to return nothing if the thumbnail was changed.
This fixes it for me:
global $post;
new TimberPost($post->ID);What version of WordPress, PHP and Timber are you using?
PHP 5.5.37
WordPress 4.7.1
Timber 1.2.1
How did you install Timber? (for example, from GitHub, Composer/Packagist, WP.org?)
Composer
Reactions are currently unavailable