| 510 | | $pages[ $component_name ] = wp_insert_post( array( |
| 511 | | 'comment_status' => 'closed', |
| 512 | | 'ping_status' => 'closed', |
| 513 | | 'post_status' => 'publish', |
| 514 | | 'post_title' => $page_name, |
| 515 | | 'post_type' => 'page', |
| 516 | | ) ); |
| | 510 | $exists = get_page_by_path( $component_name ); |
| | 511 | |
| | 512 | // If page already exists, use it |
| | 513 | if ( ! empty( $exists ) ) { |
| | 514 | $pages[ $component_name ] = $exists->ID; |
| | 515 | } else { |
| | 516 | $pages[ $component_name ] = wp_insert_post( array( |
| | 517 | 'comment_status' => 'closed', |
| | 518 | 'ping_status' => 'closed', |
| | 519 | 'post_status' => 'publish', |
| | 520 | 'post_title' => $page_name, |
| | 521 | 'post_type' => 'page', |
| | 522 | ) ); |
| | 523 | } |