Skip to content

Commit

Permalink
Use post.slug directly
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed Sep 25, 2024
1 parent ded122c commit 3344a5b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,11 @@ export const ExperimentalEditorProvider = withRegistryProvider(
const postContext = {};
// If it is a template, try to inherit the post type from the slug.
if ( post.type === 'wp_template' ) {
const themeSlug = post.slug;
if ( themeSlug === 'page' ) {
if ( post.slug === 'page' ) {
postContext.postType = 'page';
} else if ( themeSlug === 'single' ) {
} else if ( post.slug === 'single' ) {
postContext.postType = 'post';
} else if ( themeSlug.split( '-' )[ 0 ] === 'single' ) {
} else if ( post.slug.split( '-' )[ 0 ] === 'single' ) {
// If the slug is single-{postType}, infer the post type from the slug.
const postTypesSlugs =
postTypes?.map( ( entity ) => entity.slug ) || [];
Expand Down

0 comments on commit 3344a5b

Please sign in to comment.