From ce7947b16467352e35afc1b6d4b7ab9de29771a0 Mon Sep 17 00:00:00 2001 From: Shreyas Ikhar <40795917+shreyasikhar@users.noreply.github.com> Date: Sun, 19 Mar 2023 13:09:04 +0530 Subject: [PATCH] Fix permalinks of scheduled pages and scheduled CPT posts (#49092) --- .../editor/src/components/post-publish-panel/postpublish.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/editor/src/components/post-publish-panel/postpublish.js b/packages/editor/src/components/post-publish-panel/postpublish.js index 178fc2c495405..39f48d3bc811c 100644 --- a/packages/editor/src/components/post-publish-panel/postpublish.js +++ b/packages/editor/src/components/post-publish-panel/postpublish.js @@ -17,6 +17,7 @@ import PostScheduleLabel from '../post-schedule/label'; import { store as editorStore } from '../../store'; const POSTNAME = '%postname%'; +const PAGENAME = '%pagename%'; /** * Returns URL for a future post. @@ -33,6 +34,10 @@ const getFuturePostUrl = ( post ) => { return post.permalink_template.replace( POSTNAME, slug ); } + if ( post.permalink_template.includes( PAGENAME ) ) { + return post.permalink_template.replace( PAGENAME, slug ); + } + return post.permalink_template; };