• Resolved adamfoale

    (@adamfoale)


    I have a very annoying problem at the moment with page previewing in WordPress with the edit flow plugin active.  The preview function works, but it is not using the correct page template when doing so – which means my conditional ACF content blocks don’t display either.  If I disable Edit Flow, it works as expected. My templates are filename based, i.e. page-slug.php

    Has anyone come across this? Any ideas that might help me?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Gary Jones

    (@garyj)

    Can you please give me some more information to replicate it? What URLs are you trying to view? What template do you think should be being used? What template is being used? What versions of WP and Edit Flow and ACF are you using?

    Thread Starter adamfoale

    (@adamfoale)

    Hi Gary. Thanks for your reply. I can’t give you a URL because the page is in Draft on a heavily visited site and the client won’t publish until she can see the preview correctly. I’m testing on my local version and disabling Edit Flow makes the preview behave and pick the correct template file. On my local version it correctly uses page-slug.php within the render loop, on the live version it uses the default page.php template.

    To recreate, create a file based template, such as page-my-test-page.php in the theme folder with some obvious markup (like <h1>TEST</h1>), then create a page with the slug of “my-test-page“, with a status of Draft and then preview the page using WordPress’ built in preview function: i.e. “Preview in new tab” from the edit screen. The extended post status value doesn’t seem to make a difference.

    WP version 6.9.1, ACF version 6.7.0.2, Edit Flow version 0.10.3

    Thread Starter adamfoale

    (@adamfoale)

    Hi @garyj , have you had a chance to look at this yet?

    Thread Starter adamfoale

    (@adamfoale)

    @garyj , no need to look further into this. I have found the most bizarre quirk in WordPress that I’ve ever seen in 20 years of development. My page was showing the correct slug value on the main page edit screen, i.e. “my-test-page”, but under “Quick Edit” on the main “Pages” screen, the slug was blank. I have absolutely no idea how that’s even possible, or why on my local machine disabling Edit Flow fixed it. Sorry to have bothered you. I’m off for a very stiff drink.

    Plugin Contributor Gary Jones

    (@garyj)

    Hi @adamfoale — thanks for the update, glad you got to the bottom of it, and sorry for the detour. For what it’s worth, your “bizarre quirk” is very likely Edit Flow’s doing, and your instinct that disabling it fixed things locally was correct.

    Edit Flow deliberately keeps post_name empty for posts and pages that hold a custom status, to stop WordPress baking a public slug into drafts that aren’t ready to publish. The side-effect is that WordPress’s template hierarchy needs post_name to resolve page-{slug}.php, so with an empty slug it falls back to page.php. That also explains why Quick Edit showed the slug as blank on the live site — a save path that didn’t re-send post_name would have wiped it.

    I’ve opened an issue to track this and consider a fix: https://github.com/Automattic/edit-flow/issues/933. Enjoy the stiff drink — well-earned.

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.