Opened 15 months ago
Last modified 3 months ago
#59915 new defect (bug)
Preview Whilst Editing Broken
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 6.4.2 |
Component: | Editor | Keywords: | reporter-feedback |
Focuses: | ui, javascript | Cc: |
Description
When editing a page or post, trying to preview using the top right icon results in the URL
wp-admin/undefined
Previewing from the list of posts or pages works OK
Change History (11)
#1
@
15 months ago
- Component changed from General to Editor
- Keywords reporter-feedback added
- Milestone Awaiting Review deleted
#2
@
14 months ago
We are also having this issue, on version 6.4.1, can confirm the issue is not happening on 6.3.1, the likely problem is in this line: https://github.com/WordPress/WordPress/commit/04f631f2327a9248f12c22d40a851300e49ead43#diff-9dde901b5f19a95490984001825b5df1ef51f8163e0d37a56f80a2e9e742e047R7821 (or Gutenberg's: https://github.com/WordPress/gutenberg/commit/55fbdd96aa2642dff194cb69ebe02c3669eebae0#diff-74dfeb155337e94f52cf52beef506efba4a050292f9ba020022bdb7b40e9a90dR155) the link
variable is being set to undefined
#3
@
14 months ago
@jgutix
Are you able to replicate this on one of the default themes without any plugins? If not, can you provide sample code or instructions to replicate since this is not reproducible on a clean install.
#4
@
12 months ago
- Version changed from 6.4 to 6.4.2
I'm experiencing the same issue. My WordPress site is running on WordPress 6.4.2.
When manually opening the preview link in a new tab, the preview works fine. But when just clicking on the preview button in the Gutenberg editor, the browser is getting redirected to /wp-admin/undefined
. I'm experiencing this on the default post types (pages, posts) as well as custom post types.
With previous versions of WP this worked fine. We didn't change anything to the theme or plugins, so I can't imagine what's causing this issue.
#5
@
12 months ago
@mcsr are you able to replicate this issue on one of the default themes without any plugins? If not, can you provide sample code or instructions to replicate since this is not reproducible on a clean install.
#6
@
12 months ago
@jorbin We could bring the issue down to single plugin that caused the issue. After disabling the plugin and/or a fix from the plugin's developers, everything worked fine again.
Thanks!
#8
@
12 months ago
- Focuses ui javascript added
The plugin that seems to be affecting is Yoast SEO, I disabled it and was able to use the preview link, here is the report in their github: https://github.com/Yoast/wordpress-seo/issues/21133
#9
@
12 months ago
I originally posted the issue, but the problem seems to have resolved in my installation.
However I dont use Yoast SEO. I have not been able to determine whether the issue has been cleared from a wordpress update or a plugin update.
#10
@
12 months ago
@jgutix Interesting. We're also using Yoast Free, but didn't have any issues with it. In our case, it was caused by PublishPress Checklists
#11
@
3 months ago
Turns out it was our legacy code at fault for the issue in our installation, we had something like this:
var editor = wp.data.dispatch( 'core/editor' ); .... // Reference original method. var savePost = editor.savePost; ..... // Override core method. editor.savePost = function() { var currentPost = wp.data.select('core/editor').getCurrentPost(); var postPublished = wp.data.select( 'core/editor' ).isCurrentPostPublished(); var postStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' ); if ((postStatus == 'draft') || (!postPublished && postStatus == 'auto-draft')) { notices.removeNotice('excerptNotice'); notices.removeNotice('postCategoryNotice'); excerptNotice = null; postCategoryNotice = null; savePost(); return false; } ....
We were returning false which then returned the preview link as undefined
It was simply fixed by changing the last two lines to: return savePost();
P.S.: At this point I'm not sure why disabling Yoast allowed the post to be previewed ¯\_(ツ)_/¯
Hi @simonjonharding, welcome to trac and thanks for reporting this issue.
I'm not able to replicate this on 6.4.1 or with trunk. I tested with both published posts and drafts.
Can you confirm that you are seeing this issue with the default twentytwentyfour theme and no plugins activated? If this is still an issue, I think it will be best to report it in the Gutenberg repo as that is where the UI for the editor is developed.