Tag Info

Hot answers tagged

5

This is a much safer query to use and will remove related entries from the postmeta and term_relationship, unlike deathlocks query in his answer. Change the {id} to the id of each blog posts table. You can combine this query to run all the post tables at once, but try this on one table first. I've used it many times on single WP installs. DELETE a,b,c FROM ...


2

There is also a plugin that can help you do this http://wordpress.org/extend/plugins/wp-optimize/ From the website: WP-Optimize is a WordPress 2.9++ database cleanup and optimization tool. It doesn't require PhpMyAdmin to optimize your database tables. It allows you to remove post revisions, comments in the spam queue, un-approved comments within few ...


2

Terms should work like categories (which basically they are but with with different names). They are attached to posts but not dependent upon them. If you delete a post the term stays, like with categories. Custom post meta is dependent upon its post and will be deleted when the post is permanently deleted. It isn't deleted when the post is 'trashed'.


2

You'll need to edit wp-config.php. To set posts to retain a set number of revisions: define('WP_POST_REVISIONS', 3); To disable post revisions completely: define('WP_POST_REVISIONS', false );


2

As i'm new to wordpress.stackexchange.com, i cannot comment (silly idea) To further extend Chip's answer. You can also delete all revisions from the database which appear before X date to remove old revisions that are not needed, whilst keeping newer revisions to what ever limit you want. simply run the query: DELETE FROM `wp_posts` WHERE `post_type` = ...


2

ended up using ajax in the end... html; <a class="remImage" name="<?php echo $attachment->ID; ?>" href="#"><?php _e('delete');?></a> <input type="hidden" id="att_remove" name="att_remove[]" value="<?php echo $attachment->ID; ?>" /> <input type="hidden" name="nonce" id="nonce" value="<?php echo ...


2

The relationship between the term and the post is deleted, not the term itself. On front-end the query for a term with no associated posts will result in a 404 tough. But if you go to the term list in back-end you still can see term with a post count of 0. Always keep in mind that the Codex is a community project: Everybody can improve it, everybody can ...


2

I use this to delete associated media with post. If you want to test against a certain post type you can include the global $post_type variable. Pretty much it gets all attachments and deletes them one by one. Reference function delete_associated_media($id) { $media = get_children(array( 'post_parent' => $id, 'post_type' => ...


2

If you need to retain only images for last 50 posts, I don't think that a cron job or a WP cron is the best thing you can do, in WordPress you can know when a post is published, and you can run a routine everytime it happen, deleting images for the post pubblished 50 posts ago. That's easy, better performing (you do nothing if you have nothing to do, a cron ...


1

Rather than "still on" page the user actually goes to the link and then sent back after post is deleted. From your description and quick look at code this is probably line that sends user back: wp_redirect( add_query_arg('deleted', 1, $sendback) ); Since destination is filtered inside wp_redirect() $location = apply_filters( 'wp_redirect', $location, ...


1

WordPress automatically handles that if you force delete the page instead of thrashing it. The following function takes a parameter to force delete -> wp_delete_post( $postid, $force_delete )


1

First, you need a list of all available URIs. You may use my plugin T5 All URIs for that. Just activate and go to your blog on /alluris/. There is also a link to the file in your plugin list after activation. Then you need your log files, ideally one file with all requests from a long period (one year?). Run a grep for each line from all-uris over your ...


1

I did it this way. Opened Google analytics and Moved around 20 worthy posts manually to a new username, then delete all psots by admin, then moved worthy posts back. But f you have hundreds of worthy posts, then we need plugin.. someone need to create. But it should works like a counter first to gather views statistics..


1

Had this problem on a site where commenter's would post comments to the wrong posts and comment threads, had to move thousands of comments from one post to more appropriate posts on the site. I used this plugin http://wordpress.org/extend/plugins/move-wordpress-comments/ for fixing threading. With the plugin you have the option of turning the child ...


1

Consider using an external directory to store such dependencies for your scenario like WP_CONTENT_DIR.'/plugin-templates' (other then your real plugin folder) or smth. And allow users to remove it manually when they really want to uninstall. I don't think you should delete plugins to update them... BUT I NEVER USED THE DEFAULT UPDATER (I disable it ...


1

You should submit a request for Google to stop indexing them as soon as possible (accessible through the Google Webmaster Tools interface). I'm sure you know the purpose of posts, but is is that important to delete them? You could just leave them as an archive as posts were originally meant for. If you don't link to them, you don't have to worry about most ...


1

You're not closing the first if tag. /* Update user information. */ if ( !empty( $_POST['url'] ) ){ update_user_meta( $current_user->id, 'user_url', esc_url( $_POST['url'] ) ); } else{ delete_user_meta( $current_user->id, 'user_url'); } Also, you should use esc_url_raw on a raw url and then if you're echoing into the html use esc_url. You ...


1

a) delete_user hook: Here is one idea: Add this into your code to delete the user: remove_action("delete_user", "mod_redirect_subscriber_delete"); wp_delete_user($user_id); where we remove the action callback to prevent it calling it self again. So your code becomes: function mod_redirect_subscriber_delete($user_id) { $user = get_user_by('id', ...


1

You could also do this, function mod_redirect_subscriber_delete($user_id) { $user = get_user_by('id', $user_id); $role = $user->roles[0]; if ($role == 'subscriber') { add_action("deleted_user", function(){ wp_redirect( admin_url('/index.php') ); exit; }); } } add_action("delete_user", "mod_redirect_subscriber_delete"); ...


1

I'd say there is barely enough information in the question to speculate on an answer but it sounds like to me that... If your data is saved in individual key/value pairs then delete_post_meta will do it. You would pass the function a post ID and a key name: delete_post_meta(1,'keyname');. It will delete the whole key/value pair. If you have multiple bits ...


1

Is it safe to directly delete all rows in the wp_posts table that have a post_type of revision? (I've seen conflicting answers on this—but I'd love to be able to just do it this way if it's safe) Safe, it's safe. If there is only one user (you) that can edit posts on site it's safe and does not bring any other problem. If there are more, and one ...


1

'Every night' sounds like it's triggered via a cronjob. You may install the wp-crontrol plugin to see what cronjobs are sheduled in your wordpress install. If you don't see something obvious there I would also suppose it happens outside of wp. But as you already pointed out, you can only be sure when you revert everything to a stock install (disable plugins ...


1

If you mean the delete button on the user list at /wp-admin/users.php, then that button is created by the WP_Users_List_Table class around (currently) line 256. If you look a little further down-- a few lines-- you will see a filter called user_row_actions. You can use that to hide the 'delete' link. add_filter( 'user_row_actions', function($actions, ...


1

To redirect after the use of get_delete_post_link() it's probably easiest to hook into the trashed_post action: Code: add_action( 'trashed_post', 'wpse132196_redirect_after_trashing', 10 ); function wpse132196_redirect_after_trashing() { wp_redirect( home_url('/your-custom-slug') ); exit; } Or you could make it dependent on the according $_GET ...


1

@s_ha_dum suggests that Post meta will be deleted automatically. Therefore because his reputation suggests he knows what he is talking about, this solution only handles Post attachments. I'd suggest checking out the docs for the before_delete_post() hook, as it's quite handy to be able to check out what Post Type is being deleted, etc. ...



Only top voted, non community-wiki answers of a minimum length are eligible