Tag Info

New answers tagged

0

Here's my final code which answers my question. It allows the user to input a value through a text field which is then either added, replaced, or deleted from the database (if user types 'delete'). It also gets the value and displays it in the input field if there is one. function movie_edit_add_year($movie){ global $wpdb; $v = ...


0

Your problem is that you are defining the $typeName variable as an empty array at the stat of each iteration of the loop, effectively erasing it, then filling that empty array with a single term name, which you implode. You don't see any commas because you are implodeing a one term array. Move the definition to before the Loop and the implode to after it. ...


0

short exmaple how i do it... (tables naming not really correct.) in this example i am trying to save _description $_POST variable. add_action ( 'edited_term', 'custom_edited_term', 10, 3); function custom_edited_term($term_id, $tt_id, $taxonomy){ if ( defined('DOING_AJAX') || defined('DOING_CRON') ) return; $_POST = ...


1

Yes, wp_insert_term() only creates the term. To assign the term to a post use wp_set_object_terms() wp_set_object_terms( $object_id, $terms, $taxonomy, $append ); 


0

As @passatgt stated there are at least 4 actions to hook. Btw the most useful is "delete_$taxonomy" action. The action accepts 3 parameters. To use all of them you have to explicit declare how many parameters you want to receive in the callback function. You can do this by specifing it as 3rd parameter of add_action ...


1

Working off of Pieter Goosen's answer to this question, the way around this is to create a list of all the categories except the one you want to exclude, then search for posts that include them. That way, if a post has the excluded category but also other categories, it'll be included. So, in my case: $args = array ('exclude'=>1,'fields'=>'ids'); ...



Top 50 recent answers are included