WordPress.org

Make WordPress Core

Opened 4 days ago

Last modified 19 hours ago

#42612 new defect (bug)

Single post navigation bugs when adding posts in Starter Content

Reported by: bduclos Owned by:
Milestone: 4.9.1 Priority: normal
Severity: normal Version: trunk
Component: Customize Keywords: needs-patch
Focuses: Cc:

Description

To reproduce the issue:

  • Inside a fresh install of Twentyseventeen, open the functions.php file. Line 132, modify the $starter_content posts array to add 2 posts:
    <?php
    'posts' => array(
            'home',
            'about' => array(
                    'thumbnail' => '{{image-sandwich}}',
            ),
            'contact' => array(
                    'thumbnail' => '{{image-espresso}}',
            ),
            'blog' => array(
                    'thumbnail' => '{{image-coffee}}',
            ),
            'homepage-section' => array(
                    'thumbnail' => '{{image-espresso}}',
            ),
    
            'the-new-office' => array(
                    'post_type'     => 'post',
                    'post_title'    => 'The new office',
                    'thumbnail'     => '{{image-espresso}}',
                    'post_content'  => 'Maecenas tristique lobortis sem sit amet consectetur. Nullam pharetra ex ex, a aliquet ligula pellentesque a. Aenean et justo volutpat, malesuada purus a, sagittis eros.',
            ),
    
            'join-the-team' => array(
                    'post_type'     => 'post',
                    'post_title'    => 'Join the team',
                    'thumbnail'     => '{{image-coffee}}',
                    'post_content'  => 'Maecenas tristique lobortis sem sit amet consectetur. Nullam pharetra ex ex, a aliquet ligula pellentesque a. Aenean et justo volutpat, malesuada purus a, sagittis eros.',
            ),                      
    ),
    
  • Open the Customizer to load the starter content and click on the Publish button.
  • Visit the first post titled "The new office". The single navigation indicates "Hello World" as the previous post while it should be "Join the team".

I think the bug comes from the fact that the 2 posts have the same exact date. Is there a way to specify the post date when configuring the starter content?

Change History (3)

#1 @pratikgandhi
3 days ago

  • Keywords needs-patch added

Hello @bduclos

Its because both posts are published at the same time. There is no option in starter content in which we can give post_date so there is no bug in the customize.

Thanks

This ticket was mentioned in Slack in #core-customize by jeffpaul. View the logs.


20 hours ago

#3 @westonruter
19 hours ago

  • Milestone changed from Awaiting Review to 4.9.1

As I recall, a draft or auto-draft doesn't take kindly to having a post_date assigned to it. I'll need to double check that. At the very least, we could make it so that each starter content post inserted gets a post_date that decrements back 1 second for each one inserted, so that they have a stable sort according to the order they appear in the starter content config.

Note: See TracTickets for help on using tickets.