Get pages by title instead of path to prevent duplicate

This commit is contained in:
Brian Miyaji
2014-03-16 14:18:38 +11:00
parent 12864c49a5
commit f2c55dd79e
3 changed files with 10 additions and 5 deletions

View File

@@ -192,7 +192,7 @@ if ( class_exists( 'WP_Importer' ) ) {
list( $team_name, $result, $outcome ) = $team;
// Find out if team exists
$team_object = get_page_by_path( $team_name, OBJECT, 'sp_team' );
$team_object = get_page_by_title( $team_name, OBJECT, 'sp_team' );
// Get or insert team
if ( $team_object ):
@@ -252,11 +252,16 @@ if ( class_exists( 'WP_Importer' ) ) {
// Add outcome slugs to team outcomes array
foreach ( $outcomes as $outcome ):
// Continue if outcome doesn't exist
if ( $outcome == null ):
continue;
endif;
// Remove whitespace
$outcome = trim( $outcome );
// Get or insert outcome
$outcome_object = get_page_by_path( $outcome, OBJECT, 'sp_outcome' );
$outcome_object = get_page_by_title( $outcome, OBJECT, 'sp_outcome' );
if ( $outcome_object ):
@@ -331,7 +336,7 @@ if ( class_exists( 'WP_Importer' ) ) {
unset( $player[0] );
// Find out if player exists
$player_object = get_page_by_path( $player_name, OBJECT, 'sp_player' );
$player_object = get_page_by_title( $player_name, OBJECT, 'sp_player' );
// Get or insert player
if ( $player_object ):