From 4fd0ab721b2d94bef947e0f06bbc9de4a4c4cbfb Mon Sep 17 00:00:00 2001 From: Chris Abraham Date: Mon, 21 Oct 2024 14:05:05 -0400 Subject: [PATCH] Re-tag all blog posts by project to fix missing ones Signed-off-by: Chris Abraham --- .../lf-mu/admin/class-lf-mu-admin.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/web/wp-content/mu-plugins/wp-mu-plugins/lf-mu/admin/class-lf-mu-admin.php b/web/wp-content/mu-plugins/wp-mu-plugins/lf-mu/admin/class-lf-mu-admin.php index 9f3be0a8..00ac00e2 100644 --- a/web/wp-content/mu-plugins/wp-mu-plugins/lf-mu/admin/class-lf-mu-admin.php +++ b/web/wp-content/mu-plugins/wp-mu-plugins/lf-mu/admin/class-lf-mu-admin.php @@ -155,7 +155,7 @@ public function display_plugin_setup_page() { public function validate( $input ) { // This command used to tag all blog posts with projects when you save the settings in the admin. - // $this->tag_blog_posts_with_projects(); // phpcs:ignore. + $this->tag_blog_posts_with_projects(); // phpcs:ignore. $options = get_option( $this->plugin_name ); @@ -282,12 +282,16 @@ private function tag_blog_posts_with_projects() { 'category' => 230, ) ); - $projects = get_terms( 'lf-project' ); - + $projects = get_terms( + array( + 'taxonomy' => 'lf-project', + 'hide_empty' => false, + ) + ); foreach ( $myposts as $post ) { - if ( get_the_terms( $post->ID, 'lf-project' ) ) { - continue; - } + // if ( get_the_terms( $post->ID, 'lf-project' ) ) { + // continue; + // } // only add projects if there are none already assigned. $project_tags = $this->get_project_tags( $post->post_content, $projects );