If you’re running WordPress 2.1 trunk from SVN (currently at 2.1-alpha3, r4663) with Ultimate Tag Warrior (UTW) 3.141592 (the latest version as of today), UTW will lose all tags on a post when a new comment is made.
To fix this, edit the ultimate-tag-warrior-actions*.php
files (in your UTW directory, there should be one -actions.php
and one -actions-wordpress2.php
, simply edit both). In the function ultimate_save_tags($postID)
, add the following lines right after the opening curly bracket:
if (!is_admin()) return $postID;
if (!isset($_POST['tagset'])) return $postID;
Save the files and you should be all set.
The problem occurs because WordPress trunk calls the edit_post hook when new comments are added. UTW doesn’t check the environment and just assumes the admin wanted to delete all tags, and then dutifully removes the tags from the post.
The fix just does nothing when the edit_post hook gets called from outside the admin publish area.
Update: See also Thomas’ comment for the latest UTW version.
Thanks, this was a real lifesaver ๐
Thanks a lot for this fix! Like many others, it has saved me from further problems with losing tags. Keep up the good work mate! ๐
After this fix, will the tags still be deleted after a moderated comment is approved?
karrie – after you applied the fix, the problem would be solved. I’ve also had the problem and did this fix and after that my tags stayed in place. Hehe ๐
This breaks the UTW fix for ecto publishing via xmlrpc ๐
http://www.robinlu.com/blog/archives/86/
here
bruno, with the changes described in http://www.robinlu.com/blog/archives/57, it should work since $_POST[‘tagset’] is set. Or does is_admin return false for xmlrpc requests? In the latter case, I can’t think of a simple fix except maybe a define() in xmlrpc.php; if you just remove the is_admin check, anyone can modify the tagset to any post if they can comment on it.
In the latest UTW-Version (Ultimate Tag Warrior 3.1415926) you have only the file ultimate-tag-warrior-actions.php. -wordpress2.php does no longer exist. And only if you aprove a comment you will lost your tags.
I tried this (from Christines posting):
if (isset($_POST['not_spam'])) return $postID; // akismet fix
if (isset($_POST["comment"])) return $postID; // moderation.php fix
and the code from 082net (it’s above your comment)
// Save changes to tags
add_action('save_post', array('UltimateTagWarriorActions','ultimate_save_tags'));
if($wp_db_version < 3308 ) { // if lesser than WP 2.0
add_action('publish_post', array('UltimateTagWarriorActions','ultimate_save_tags'));
add_action('edit_post', array('UltimateTagWarriorActions','ultimate_save_tags'));
add_action('wp_insert_post', array('UltimateTagWarriorActions','ultimate_save_tags'));}
add_action('delete_post', array('UltimateTagWarriorActions', 'ultimate_delete_post'));
All this together fix the problem.
This works also with ecto-patch
@Thomas:
if (!isset($_POST['tagset'])) return $postID;
should work for all cases, including comment moderation. Did it not work for you?Yes,
I tried only this – but with the hook-changes at the end of the file. Without the hook-changes it doesn’t work.
Doesn’t work with 2.1.2. Spent hours on this, need to figure out if xmlrpc.php needs yet another tweak to work with Ecto.