Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleted projects are not removed #27

Open
superlou opened this issue Oct 20, 2020 · 0 comments
Open

Deleted projects are not removed #27

superlou opened this issue Oct 20, 2020 · 0 comments

Comments

@superlou
Copy link
Contributor

In cablecast_sync_projects, there is no mechanism to remove a project that has been removed on the backend.

function cablecast_sync_projects($projects) {
foreach ($projects as $project) {
$processed = cablecast_replace_commas_in_tag($project->name);
$term = term_exists( $processed, 'cablecast_project' ); // array is returned if taxonomy is given
if ($term == NULL) {
wp_insert_term(
$processed, // the term
'cablecast_project', // the taxonomy
array(
'description' => empty($project->description) ? '' : $project->description,
)
);
} else {
wp_update_term($term['term_id'], 'cablecast_project', array(
'description' => empty($project->description) ? '' : $project->description,
));
}
}
}

If we had a way to keep track of which terms still exist, is it safe to call wp_delete_term on any remaining terms? Is there any chance that $projects may not contain all projects in Cablecast due to a server response error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant