PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | inc/class-wpseo-primary-term.php +6 -0 18.9 → trunk View file →
@@ -42,8 +42,12 @@
42 42 */
43 43 public function get_primary_term() {
44 44 $primary_term = get_post_meta( $this->post_ID, WPSEO_Meta::$meta_prefix . 'primary_' . $this->taxonomy_name, true );
45 45
46 + if ( ! $primary_term ) {
47 + return false;
48 + }
49 +
46 50 $terms = $this->get_terms();
47 51
48 52 if ( ! in_array( (int) $primary_term, wp_list_pluck( $terms, 'term_id' ), true ) ) {
49 53 $primary_term = false;
@@ -56,8 +60,10 @@
56 60 /**
57 61 * Sets the new primary term ID.
58 62 *
59 63 * @param int $new_primary_term New primary term ID.
64 + *
65 + * @return void
60 66 */
61 67 public function set_primary_term( $new_primary_term ) {
62 68 update_post_meta( $this->post_ID, WPSEO_Meta::$meta_prefix . 'primary_' . $this->taxonomy_name, $new_primary_term );
63 69 }