Opened 7 years ago
Last modified 6 years ago
#41226 reopened defect (bug)
Static "posts page" preview not working
Reported by: | emross | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | needs-testing has-patch needs-unit-tests |
Focuses: | administration | Cc: |
Description
My site has both a static front page and a static posts page. The former is intended to be the site's home page, the latter the blog section home page.
The static posts page is a regular page, created through the admin interface. Some parts of it are editable by admin - this is a design choice driven by project needs.
Whenever I update the static posts page through the editor, the preview doesn't work: clicking on the "preview" shows the preview of the "front page" instead.
Apart from that, everything works on the front-end side, and I can edit and save the posts page as needed.
Unfortunately, as the project is being currently developed, I can't publicly publish urls or screenshots at the time.
Attachments (1)
Change History (10)
#3
@
7 years ago
- Component changed from General to Posts, Post Types
- Focuses ui removed
- Resolution invalid deleted
- Status changed from closed to reopened
- Version 4.8 deleted
I can actually confirm this. Every second time I press the "Preview Changes" button from inside Edit Page (post.php
) for the designated posts page I get the front page and every second time I get the actual latest posts.
Tested with 4.8 and 4.9-alpha using Twenty Seventeen.
#5
@
7 years ago
- Keywords needs-testing added
Using Firefox, editing "Post page", using WP 4.9-alpha- and Twenty Seventeen or Twenty Sixteen, no plugins, and without any unsaved changes:
"Preview Changes" button link: http://beta.example.com/blog/?preview=true and opens in a new tab
First click goes to URL: http://beta.example.com/blog/?preview_id=103&preview_nonce=38fb94e266&_thumbnail_id=-1&preview=true and shows front page content without the front page header
Second click goes to: http://beta.example.com/blog/ and shows recent posts
All odd sequence clicks is like first, and even clicks are like second.
Server: LiteSpeed, PHP 7.0.20, Document Root is a subdir of public_html
, WordPress Address and Site Address are the same.
Permalinks: /%year%/%postname%/
. Switching to "Plain" gives same results.
#6
@
7 years ago
It seems the result of second click, or on even number of clicks, has the same behaviour for any page. So that is not the real issue here, but since it causes the actual page to be viewed (not previewed), at least on every second click, it may be a bit confusing when testing of the real issue.
The issue is that the preview, when it should be active, according to the URL query string, doesn't make WordPress show the posts page, but rather the front page. This only happens with the "Posts Page".
#7
@
7 years ago
I can confirm.
Test settings:
page_on_front: 1
show_on_front: page
page_for_posts: 9
posts page (normal)
page_id: 9
is_home(): bool(true)
is_page(): bool(false)
is_preview(): bool(false)
is_front_page(): bool(false)
posts page (preview)
page_id: 1
is_home(): bool(false)
is_page(): bool(true)
is_preview(): bool(true)
is_front_page(): bool(false)
Cause:
class-wp-query.php
if ( $this->is_home && (empty($this->query) || $q['preview'] == 'true') && ( 'page' == get_option('show_on_front') ) && get_option('page_on_front') ) { $this->is_page = true; $this->is_home = false; $q['page_id'] = get_option('page_on_front'); }
Hi Welcome to WordPress core trac.
This is a place where confirmed bugs in WordPress core (or enhancement to the same) are tracked. It's NOT intended for support.
Better options are https://wordpress.org/support or the WordPress IRC (more info at https://make.wordpress.org/support/irc-support-channel/ )
Note: If you're using a commercial theme, then you should instead contact the theme vendor for support.