Skip to content

Deleted projects are not removed #27

@superlou

Description

@superlou

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions