Skip to content
Snippets Groups Projects
Commit 2af979f5 authored by Jackreichert's avatar Jackreichert
Browse files

Logic fix

Replaces nested conditions with if else if
parent e98e90bc
No related branches found
No related tags found
No related merge requests found
...@@ -223,19 +223,17 @@ class Syndication_WP_RSS_Client extends SimplePie implements Syndication_Client ...@@ -223,19 +223,17 @@ class Syndication_WP_RSS_Client extends SimplePie implements Syndication_Client
if ( isset( $result->term_id ) ) { if ( isset( $result->term_id ) ) {
$ids['cats'][] = $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 { } else {
if ( $result = get_term_by( 'name', $cat->term, 'post_tag' ) ) { // creates if not
if ( isset( $result->term_id ) ) { $result = wp_insert_term( $cat->term, 'category' );
$ids['tags'][] = $result->term_id; if ( isset( $result->term_id ) ) {
} $ids['cats'][] = $result->term_id;
} else { }
// 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 // returns array ready for post creation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment