Articles of deleting

How to mass-delete inline styles in WordPress custom post type automatically?

I’m looking for a pragmatic way to delete about 100+ individual pages worth of inline styles. I had entered in content for a client by copying and pasting from Word, which took all that data with it and wrapped it in inline styles. It doesn’t make sense to go through each post individually. Has anyone […]

Delete Associated Media Upon Page / Post Deletion

I found this code. But not work for me. Where to insert the code? I try wp-content/theme/mytheme/functions.php – not work. wp-includes/post.php – not work. wp-includes/functions.php – not work. And I make plugin (but this the first), not work. Plugin download. My WordPress version is 4.2.2. Big Thanks, and sorry I’m rookie!

Deleting Custom Post type data using mySQL command

I have around 2000 posts under a custom post type storelocations. Deleting them from WordPress admin takes a lot of time. How to delete all the posts from this custom post type from database using mySQL command. Here is my approach: DELETE FROM ‘wp_posts’ WHERE ‘post_type’ = ‘storelocations’ But I guess the post also have […]

How to delete old posts' edits to save space?

I need to delete old edits and autosave, they have grown overtime, and are not needed anymore, seeing this post: https://wordpress.stackexchange.com/a/67228/27148 it states: If you have no use for the post revisions and autosaves then disable them in wp-config and WordPress will clean them up on its own but I can’t find exactly where to […]

How to delete user roles?

I installed BuddyPress which created additional user roles but even after deleting BuddyPress those roles are still there. How can I delete these roles? I have tried the remove_role() command but it did not work.

Some way to Flush or Overwrite all Imported Content in a Site for a Fresh Import – How?

Some way to Flush or Overwrite all Imported Content in a Site for a Fresh Import – How? Is there an easy quick way to do this? To delete all Pages, Posts, Comments and stuff that got imported? Or some way to force a FLUSH of the information when I import a new .XML? I’ve […]

Delete a specific item menu when I deactivate my plugin

When I activate my plugin (register_activation_hook), I add a new specific page and a corresponding item menu in the custom menu. No problem here. When I deactivate my plugin (register_deactivation_hook), I delete the specific page but I don’t know how to delete the corresponding item menu from the custom menu?

Delete row of custom table in WordPress using AJAX

From my custom table ($table = $wpdb->prefix . ‘user_req’;) I’m showing data with $wpdb->get_results() and a foreach loop: I managed to update the database with the individual values from the form where there is a “Submit” button. But, from this table I want to delete any of the row by clicking on the (x) button […]

Redirect After Delete User in Backend

How do I redirect to a certain page after user deletion? For demonstration purpose, let’s say I want to redirect to the dashboard on user subscriber deletion. This is what I have tried so far: function mod_redirect_subscriber_delete($user_id) { $user = get_user_by(‘id’, $user_id); $role = $user->roles[0]; if ($role == ‘subscriber’) { wp_redirect( admin_url(‘/index.php’) ); exit; } […]

Allow role to delete posts but block him the wp-admin

I have a custom user role : Photograph. This role should not be able to log into the back-office, but have to be able to delete their own posts from the front-end. I am using this code to block all non-admin user from connecting to the backoffice with this (function.php) : add_action( ‘init’, ‘blockusers_init’ ); […]