New filter/hooks for terms actions

  1. aliwebdesarrollo

    I would like to suggest 2 new filters for taxonomies.

    I just need to avoid users delete or update terms(create already have a hook) from custom taxonomies.

    When i try the logical filters "pre_delete_term" or "pre_update_term" i just realize that doesn't work, and i found that it doesnt exist a filter to avoid or modify terms before update or delete.

    I just simple check the code in file "wp-includes/taxonomy.php" and update it with this simple lines that could be useful sometimes:

    /* Hook Delete term - Add it in line 1845*/
    $term = apply_filters( 'pre_delete_term', $term, $taxonomy );
    if ( is_wp_error( $term ) )
    return $term;

    /* Hook Update term - Add it in line 2524 */
    $term = apply_filters( 'pre_update_term', $term, $taxonomy );
    if ( is_wp_error( $term ) )
    return $term;

    Posted: 5 years ago #

RSS feed for this topic


You must log in to post.

  • Rating

    0 Votes
  • Status

    This idea is under consideration