From 2af979f56a10372a2b7b5b0676a6057ec2158a23 Mon Sep 17 00:00:00 2001 From: Jackreichert <jack@jackreichert.com> Date: Tue, 20 May 2014 20:33:39 -0400 Subject: [PATCH] Logic fix Replaces nested conditions with if else if --- includes/class-syndication-wp-rss-client.php | 22 +++++++++----------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/includes/class-syndication-wp-rss-client.php b/includes/class-syndication-wp-rss-client.php index c07dfb7..88cf013 100644 --- a/includes/class-syndication-wp-rss-client.php +++ b/includes/class-syndication-wp-rss-client.php @@ -223,19 +223,17 @@ class Syndication_WP_RSS_Client extends SimplePie implements Syndication_Client if ( isset( $result->term_id ) ) { $ids['cats'][] = $result->term_id; } + } elseif ( $result = get_term_by( 'name', $cat->term, 'post_tag' ) ) { + if ( isset( $result->term_id ) ) { + $ids['tags'][] = $result->term_id; + } } else { - if ( $result = get_term_by( 'name', $cat->term, 'post_tag' ) ) { - if ( isset( $result->term_id ) ) { - $ids['tags'][] = $result->term_id; - } - } else { - // creates if not - $result = wp_insert_term( $cat->term, 'category' ); - if ( isset( $result->term_id ) ) { - $ids['cats'][] = $result->term_id; - } - } - } + // creates if not + $result = wp_insert_term( $cat->term, 'category' ); + if ( isset( $result->term_id ) ) { + $ids['cats'][] = $result->term_id; + } + } } // returns array ready for post creation -- GitLab