Strip slashes to avoid duplicating teams during import

This commit is contained in:
Brian Miyaji
2015-10-05 12:17:44 +11:00
parent fe7575f8e7
commit 46426eea17
3 changed files with 5 additions and 5 deletions

View File

@@ -188,7 +188,7 @@ if ( class_exists( 'WP_Importer' ) ) {
list( $team_name, $result, $outcome ) = $team;
// Find out if team exists
$team_object = get_page_by_title( $team_name, OBJECT, 'sp_team' );
$team_object = get_page_by_title( stripslashes( $team_name ), OBJECT, 'sp_team' );
// Get or insert team
if ( $team_object ):
@@ -257,7 +257,7 @@ if ( class_exists( 'WP_Importer' ) ) {
$outcome = trim( $outcome );
// Get or insert outcome
$outcome_object = get_page_by_title( $outcome, OBJECT, 'sp_outcome' );
$outcome_object = get_page_by_title( stripslashes( $outcome ), OBJECT, 'sp_outcome' );
if ( $outcome_object ):
@@ -332,7 +332,7 @@ if ( class_exists( 'WP_Importer' ) ) {
unset( $player[0] );
// Find out if player exists
$player_object = get_page_by_title( $player_name, OBJECT, 'sp_player' );
$player_object = get_page_by_title( stripslashes( $player_name ), OBJECT, 'sp_player' );
// Get or insert player
if ( $player_object ):

View File

@@ -98,7 +98,7 @@ if ( class_exists( 'WP_Importer' ) ) {
$i = 0;
foreach ( $teams as $team ):
// Get or insert team
$team_object = get_page_by_title( $team, OBJECT, 'sp_team' );
$team_object = get_page_by_title( stripslashes( $team ), OBJECT, 'sp_team' );
if ( $team_object ):
if ( $team_object->post_status != 'publish' ):
wp_update_post( array( 'ID' => $team_object->ID, 'post_status' => 'publish' ) );

View File

@@ -94,7 +94,7 @@ if ( class_exists( 'WP_Importer' ) ) {
$i = 0;
foreach ( $teams as $team ):
// Get or insert team
$team_object = get_page_by_title( $team, OBJECT, 'sp_team' );
$team_object = get_page_by_title( stripslashes( $team ), OBJECT, 'sp_team' );
if ( $team_object ):
if ( $team_object->post_status != 'publish' ):
wp_update_post( array( 'ID' => $team_object->ID, 'post_status' => 'publish' ) );