Skip to content

Commit

Permalink
added a check for an existing portfolio page when trying to create a …
Browse files Browse the repository at this point in the history
…new archive page

If, after importing the demo, an archive portfolio page has already been added, then there is no need to create it again. You just need to add it to the option and define it in the plugin as an archive page
  • Loading branch information
Fellan-91 committed Dec 21, 2023
1 parent 287abe7 commit ea7cb71
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions classes/class-archive-mapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -1065,8 +1065,8 @@ public static function create_archive_page( $custom_slug = 'portfolio' ) {
'post_name' => $custom_slug,
);

// Insert the post into the database.
$post_id = wp_insert_post( $args );
// Check page if Archive Exist and set as Portfolio page or Insert the post into the database.
$post_id = self::get_unset_archive_page() ?? wp_insert_post( $args );

if ( ! is_wp_error( $post_id ) ) {

Expand Down

0 comments on commit ea7cb71

Please sign in to comment.