Tag Info

New answers tagged

2

So long as you're in the loop, you can just use the standard template tags: <script type="text/javascript" charset="utf­8"> initFrame({ app_id: "", object_id: <?php the_ID() ?>, object_title: "<?php the_title_attribute() ?>", object_content: '<?php echo wp_trim_words( strip_shortcodes( striptags( ...


0

The hook that is running before deleting the term is 'delete_term_taxonomy' And it is the hook needed in order to use the term_id before it gets deleted. Now, we can proceed to retrieve the term object and delete the postmeta related to the term being deleted. The code is as follows: add_action( 'delete_term_taxonomy', function($tt_id) { $taxonomy = ...


0

I finally found the solution to delete all the postmeta related to the term being deleted. For this, we need to use the action hook 'delete_term_taxonomy' because it is executed before the term is deleted; therefore, we can find the term object and use it inside the hook. Then, we proceed to perform certain task such as deleting all postmeta related to the ...


0

Actually, you can use multiple actions, at least this is what at the end of the wp_delete_term function, which runs when you click Delete on a taxonomy term: do_action( 'delete_term_taxonomy', $tt_id ); do_action( 'deleted_term_taxonomy', $tt_id ); do_action( 'delete_term', $term, $tt_id, $taxonomy, $deleted_term ); do_action( "delete_$taxonomy", $term, ...


1

The last (fourth) argument that you pass to wp_set_object_terms() is true, which, "If true, tags will be appended to the object. If false, tags will replace existing tags". It sounds as though you are instructing wp_set_object_terms() to do, if I understand you, exactly what you don't want it to do. I think that you need to set the last argument to false or ...



Top 50 recent answers are included