Skip to content

Commit

Permalink
Re-tag all blog posts by project to fix missing ones
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Abraham <[email protected]>
  • Loading branch information
cjyabraham committed Oct 21, 2024
1 parent 0f62b13 commit 4fd0ab7
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit 4fd0ab7

Please sign in to comment.