[wp-hackers] howto delete category via administrator panel
Uwiuw Bakawan.com
uwiuw at yahoo.com.sg
Sat Mar 13 11:43:02 UTC 2010
hi, thanks for the reply ;)
> but I'm not sure you have the appropriate actions.
What do you mean ? i don't understand it.
by the way, i have try to use this debug function on various actions stated in wp_delete_term function (as you had mention before)
function blind_debug()
$numargs = func_num_args();
$GLOBALS['debugku']['clean_term_cache filter']['Total Argumen'] = $numargs;
if (isset($numargs)) {
for ($i = 0; $i < $numargs; $i++) {
$GLOBALS['debugku']['clean_term_cache via filter']["arg " . $i] = func_get_arg($i);
}
}
$debugoutput = print_r($GLOBALS['debugku'], TRUE);
echo "<pre style='font-size:14px'>about : $debugoutput </pre>";
die();
wp_die("viva la republic! pun langit runtuh, NKRI sampe mati! ");
}
in wp_delete_term (in /wordpress-2.9.1/wp-includes/taxonomy.php), there're action such as :
1. edit_term_taxonomies and edited_term_taxonomies
2. delete_term_taxonomy and deleted_term_taxonomy
3. clean_term_cache
4. delete_term and delete_$taxonomy
i use add_action and add_filter such as
add_action('edit_term_taxonomies', 'blind_debug')
add_filter('edit_term_taxonomies', 'blind_debug')
While the output of every debug
1. delete_term and delete_$taxonomy, the output is the deleted CAT ID
2. clean_term_cache, the output is the the deleted CAT ID and the default category ID
3. delete_term_taxonomy and deleted_term_taxonomy, are empty. no output. The blind_debug function is never execute.
4. edit_term_taxonomies and edited_term_taxonomies also empty
5. wp_delete_term also empty.
when debugging clean_term_cache, delete_term and delete_$taxonomy, i try to use get_categories(array('hide_empty' => 0 ). But somehow, the output only the default category object. It seem the category list can not be access.
i try not to put any validation function via 'init', or 'admin_init', to do the process of deleting. i hope i can find another hook to start the deleting process.
Right now, i got this everytime a category delete from admin panel.
$_GET [action] => delete
[doaction] => Apply
[_wpnonce] => 9503c9c45d
[_wp_http_referer] => /wp-admin/categories.php
[delete] => Array
(
[0] => 120
)
[action2] =>
scribu, sorry to bother you more on this subject
--- On Sat, 13/3/10, scribu <scribu at gmail.com> wrote:
> From: scribu <scribu at gmail.com>
> Subject: Re: [wp-hackers] howto delete category via administrator panel
> To: wp-hackers at lists.automattic.com
> Date: Saturday, 13 March, 2010, 2:35 PM
> On Sat, Mar 13, 2010 at 1:32 AM,
> Uwiuw Bakawan.com <uwiuw at yahoo.com.sg>wrote:
>
> >
> > i'm sorry i put wrong information. in my previous
> email, i mention about
> > post. What i meant is about delete category via
> dashboard >> categories
> >
> > so, about the term_taxonomy_id, should i
> > 1. retrieve the delete category ID value from 'init'
> > 2. took it child category id via get_category such as
> >
> > foreach ( get_category() as $category ) {
> > if ( $category->parent ==
> $delete_parent_cat_ID ) {
> >
> //do the job here
> > }
> > }
> >
> >
> > 3. delete all of its child category post then delete
> the child
> >
> > is there any better approach then this ?
> >
>
> It would be better if you could hook into
> wp_delete_term()<http://xref.yoast.com/2.9.1/nav.html?_functions/wp_delete_term.html>,
> but I'm not sure you have the appropriate actions.
>
>
> --
> http://scribu.net
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
Start chatting with friends on the all-new Yahoo! Pingbox today! It's easy to create your personal chat space on your blogs. http://sg.messenger.yahoo.com/pingbox
More information about the wp-hackers
mailing list