The tag has no usage guidance.

learn more… | top users | synonyms

13
votes
1answer
534 views

Is there a action hook for the “Empty Trash” button?

I would like to run a function when the user clicks the "Empty Trash" button for posts. Something like: add_action('empty_trash','myFunction'); function myFunction(){ // My code }
6
votes
4answers
1k views

How to delete post revisions?

I haven't set a limit to the number of revisions, which makes some of my post have more than 20 revisions, so how to delete these revisions? By the way, I am using WPMU and have many blogs, so how to ...
6
votes
1answer
406 views

Automatically delete inactive users after 2 months

I am trying to modify this function: // automatically delete users after 7 days in wordpress function wcs_auto_delete_users() { global $wpdb; $query = $wpdb->prepare( "SELECT ID FROM $wpdb->...
5
votes
2answers
4k views

Correctly delete posts with meta and attachments [duplicate]

I am having an overview of custom post types. These have custom tax and also an attachment. In my overview I need to provide links to delete the entries. With that I also need to delete the ...
4
votes
5answers
558 views

Delete Post With No Traffic?

My site has over 8k posts, some of which are outdated. To keep site maintainable and tidy, I want to delete all post with no traffic. Can this be done? Is there any plugin for this purpose? Or any ...
4
votes
1answer
2k views

delete attachment from front end

logged in as admin and trying to code that deletes posts to delete an attachment. got, <?php if (current_user_can('edit_post', $attachment->ID)) echo "<a href='" . wp_nonce_url("/wp-admin/...
4
votes
1answer
405 views

Threaded comments - deleting parent comment leads to orphan comments

Got an issue on a site where deleting a comment with replies (where threaded commenting is activated), leads to the child comments being orphaned, causing unexpected behaviour (such as the orphaned ...
4
votes
1answer
54 views

Delete a specific category when deleting a user

I'm using the following function to create a portfolio category named "tips_username" when a user registers on my website. add_action('user_register', 'auto_create_traveltip_category'); function ...
3
votes
1answer
556 views

Auto delete WordPress images/thumbnails (all sizes) and featured after X days/hours, or similar?

I am looking for solution to auto delete images of old posts in WordPress site. I want to hold images of current 50 posts, others should be deleted automatically. It can be function to delete on time ...
3
votes
2answers
541 views

Delete all the custom post types when deleting user

I have a problem in custom post types, when I remove user, I can't deleted there post or attribute all posts.
2
votes
1answer
7k views

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 ...
2
votes
1answer
1k views

get_delete_post_link redirect

I am using this to allow users to delete their own posts on the front end of my site: <a onclick="return confirm('Move this post to the trash? You can restore it later.');" href="<?php echo ...
2
votes
2answers
414 views

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: ...
1
vote
3answers
554 views

Prevent from deleting any user role but subscriber

In the administration of my blog, I would like to prevent anyone (admin included) from deleting any user unless it is a simple subscriber. Basicaly, in the "users" section of the administration, I ...
1
vote
3answers
1k views

Safest way to bulk delete post revisions

One of my clients is on a rather large blog in terms of number of posts and traffic. I'm trying to get her database down to a manageable size, and one thing that's bulking up is literally tens of ...
1
vote
2answers
120 views

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: http://wordpress.stackexchange.com/a/67228/27148 it states: If you have no use ...
1
vote
2answers
216 views

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 ...
1
vote
2answers
1k views

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 ...
1
vote
1answer
93 views

Posts are deleted everyday at night

So I have a weird issue with WP and that is that all Posts on the site are getting deleted sometime in the night. Before I turn of all plugins and change theme to default.. I would like to know if ...
1
vote
1answer
763 views

update user information

this is my code /* Update user information. */ if ( !empty( $_POST['url'] ) ){ update_user_meta( $current_user->id, 'user_url', esc_url( $_POST['url'] ) ); else{ ...
1
vote
0answers
31 views

Wordpress stuck in deleting user

We’ve run into an issue with our WP Multisite where we cannot delete user accounts. The URL i keep getting is: http://example.com/wp-admin/network/users.php?action=dodelete It should look something ...
1
vote
3answers
938 views

Alow users to delete uploaded images inside backend?

I am allowing user's to upload their images, so to show their uploaded images i am using<?php echo $options_images['image_bg'];?> which outputs this:http://www.mydomain.com/myfolder/wp-content/...
1
vote
2answers
2k views

Nav menu items disappearing (but not immediately)

I'm working on a site where some of the nav menu items disappear (from the front end, the back end, and the database). However, debugging is extremely difficult since they don't disappear immediately! ...
0
votes
3answers
45 views

What will happen if I delete all my attachment type posts from database?

OK maybe I'm a bit hysterical about performance, but I don't see any reason to have more than double the post entries I need in my database. I mean every image automatically creates an attachment ...
0
votes
1answer
35 views

Why is this custom taxonomy showing in the database?

I have created a plugin that add geographic data to Wordpress. According to this answer the taxonomy data should not be stored in the database, however it seems to be stored: mysql> select * from ...
0
votes
1answer
114 views

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. ...
0
votes
1answer
63 views

How safe is it to delete old posts edits to save database space?

After this question: http://wordpress.stackexchange.com/a/93902/27148 There is an answer that suggests deleting past edits directly from database, which would be nice, because I could create ...
0
votes
1answer
237 views

After deleting a post are terms, and custom meta deleted?

I have a custom post type setup with a custom taxonomy. Once a post is created with custom meta data and terms in the custom taxonomy. If I delete the post does it delete the terms and custom meta?
0
votes
2answers
52 views

Is codex right on deleting post?

The codex has this to say on wp_delete_post. When the post and page goes, everything that is tied to it is deleted also. This includes comments, post meta fields, and terms associated with ...
0
votes
1answer
17 views

Delete post: 2 wp_redirect if pages are different

My website allows users to publish and manage posts from frontend. I've created a kind of account section where they have all their posts published which they can edit and delete. They can even delete ...
0
votes
1answer
258 views

Delete post image attachments with jQuery from the front end

In my WP 4.4 Twenty Sixteen child theme I want to delete post image attachments from a front end form created by a plugin. To achieve this I followed this answer, but the delete links doesn't delete ...
0
votes
1answer
52 views

Which delete query is better with prepare or delete

Just wondering which of the two delete queries would be the preffered method $qdel = $wpdb->query($wpdb->prepare("DELETE FROM $shopping_meta_table WHERE meta_shopping_key = '%s' AND wp_user_id =...
0
votes
1answer
310 views

Auto delete Wordpress users according to time

In my wordpress site spam users are registered so i am add mail confirmation to my resister area. And my problem is how can i delete users when not check or activated the mail. is it possible to ...
0
votes
2answers
277 views

Why does my delete_post hook get called twice

Here is how I've implemented it: add_action( 'delete_post', array( 'MyClassName', 'delete' ) ); In the delete function I was using a $wpdb->insert command to see whether the function gets called. ...
0
votes
1answer
87 views

How to make the 'delete' button inactive on some categories?

As currently there's no way to declare any new custom post format in WordPress (3.9.1), is there a way I can make the 'delete' button on some categories inactive, so that the Editor can't remove them, ...
0
votes
1answer
271 views

Delete link on single-custom.php with redirection

I need to provide a delete link for my users on the single page of a custom post type. But when the entry is deleted the user will end in a nothing found on this page wordpress error (because we are ...
0
votes
1answer
91 views

remove a single post_meta

I created a plugin that has multiple meta boxes. One meta box saves a single record by using update_post_meta(). Another meta box saves multiple record by using add_post_meta(). I do not have ...
0
votes
1answer
141 views

Delete a specific item menu when I deactivate my plugin (resolved)

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 (...
0
votes
2answers
273 views

Deleting old posts

I have around 30 old posts that I want to delete on my blog. Can I just delete them permanently or should I worry about the "errors" I will get on my google webmasters tools and redirect them somehow?
0
votes
1answer
105 views

How to display an alert when deleting a plugin?

My plugin allows for some custom templates to be installed into it by the user. Problem is, if someone deletes the plugin from WP in order to install a new version, all their custom files get deleted ...
0
votes
0answers
15 views

The custom “Delete Post” button works only on second time you click it

I created a delete button on frontend for blog posts and custom type posts and I would redirect to a specific page after deleting them. The code that I used for the deleting url is: add_query_arg( '...
0
votes
1answer
19 views

Delete all blogs on multisite

I'm writing a function that will delete all blogs (except the main one) from a multisite, the function is dieing whenever I call wpmu_delete_blog and I've got no idea why. $blogs = wp_get_sites( ...
0
votes
1answer
54 views

Undeletable posts, users or other content

Recently I tried to move a WordPress instance to a production server and (besides other issues) had to deal with a page that could not be deleted via the admin panel. The success message would show up ...
0
votes
1answer
39 views

A delete/trash all function?

Is there a function (or a predefined set of functions) that will clear all posts, post tags and categories, all custom posts and custom post terms, attachments, menus and customizer settings? So far ...
0
votes
0answers
22 views

Hook To Get All Posts Deleted

I've added an which makes a call to an external service every time a post is deleted. However, it's on the delete_post hook, which works fine when I delete a single post, but if multiple posts are ...
0
votes
1answer
68 views

How to trigger function on theme delete?

Tried to find an or some hook to fire a function when theme is being delited, but didn't find any hook.. May be someone can tell if there's a way to fire my function on themes delete event? I need ...
0
votes
0answers
60 views

Delete custom fields on post publish?

I have some custom fields, for example one is named "thumb". Custom field is generated automatically by some plugin. I do not use it at all. Is there any function which will delete that custom field ...
0
votes
2answers
254 views

Bulk delete users from a csv list

I have a WordPress site with 65,000 registered users, about 10,000 of those users are spam bots, inactive account, hard email bonces etc. I have them gathered in a CSV list, how can I use that csv ...