add_action for publish_post doesn’t work

No offense, but I think I’m agreeing with a commenter from your other question… You really need to read PHP, MySQL, and regular expression tutorials before you get into any of this. More importantly, you need to learn how to search a code base using regular expressions in your favorite editor, and understand the code … Read more

SQL error with custom query

Should be: $where .= ” AND voted > 1″; Other notes: instead of hardcoding table names you should use $wpdb->prefix . ‘post_votes’; instead of checking in global $_GET you should declare your filters as accepting two arguments and code functions accordingly, these filters pass as second argument object that contains all of query data. Like: … Read more

Removal of all posts content in bulk, keeping the posts itself

Do not run this on a live site until you’re tested it on a backup or local installation and confirmed valid results, i won’t take any resposibility for lost data, should that occur. SQL Query To run from PhpMyAdmin UPDATE wp_posts SET post_content=”your_content” WHERE post_type=”post” Inside WordPress To use inside a plugin or your functions … Read more

Deleting post tags removes categories

I’m not sure about this, but the way the tables are setup, WordPress can re-use the same terms record (with the same term_id) within different taxonomies. That is, if you have a post_tag called favorites and you also have a category called favorites, it can well be that WP uses the same terms record for … Read more

How to add categories using mysql

You would want to create an array of those values from your spreadsheet and loop through them to call the wp_insert_category function on each one. http://codex.wordpress.org/Function_Reference/wp_insert_category