Questions tagged [wp-delete-post]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
25 views

wp_delete_user - huge overhead in Buddypress?

I am running a Buddypress Website with 8k Users and I want to create a fresh installation as a base for a new project. I do not want to touch the DB directly because I feel it's dirty and could ...
user avatar
  • 152
0 votes
0 answers
48 views

Unable to delete related media attachments with deleted post

I want to delete the post attachments too from the 'Media" panel once a custom post is deleted. The post itself gets deleted well, but its media still remains in the wordpress "media" ...
user avatar
1 vote
1 answer
372 views

Remove post if exist by title

I want to remove a post from PHP by title. I have a code for publish or update if the post exist by title, but I don't know how to insert the wp_delete_post() function. This is my actual code for ...
user avatar
0 votes
1 answer
247 views

How to properly delete custom post type posts programmatically

I created a new custom post type that users can add new post from frontend and it works as desired. Now, I´m trying to add a button to delete. This is the code triggered by the button: if( ...
user avatar
-1 votes
2 answers
228 views

How to Delete Posts by title?

I have about 2000 titles. How can I automatically delete posts with these titles? For example
user avatar
  • 21
0 votes
1 answer
96 views

`wp_delete_post` returns NULL

I am trying to delete a lot of WordPress posts programmatically using wp_delete_post, but not all posts are deleted successfully. In some cases I get NULL as a return value for wp_delete_post($row->...
user avatar
0 votes
1 answer
141 views

Auto delete pages/posts without views

Hello please does anyone know a way to automatically delete posts that doesn't get views within a period of time. Lets say if a post on my site is made and within 30 days, there are no views on the ...
user avatar
0 votes
1 answer
123 views

$wpdb->delete not working for me

I have a function (see in full below) that syncs data into WP from an external database. It's a list of scheduled items. When the schedule is updated, old data should be deleted. See this snippet: $...
user avatar
  • 41
0 votes
1 answer
23 views

How to delete a post and keep its slug to refer to another post

I've 2 almost identical posts: https://webscraping.pro/reliable-open-proxies-for-business-directories-scrape/ https://webscraping.pro/reliable-rotating-proxies-for-business-directories-scrape/ I ...
user avatar
0 votes
1 answer
170 views

Filter DELETE REST API calls

I have a custom post type, that can be editable by more than one user. Each post of that type has a field with the user ids who can edit it (kinda like co-authors). But since many users have ...
user avatar
0 votes
2 answers
63 views

After creating Custom post type by user delete old one

I have created a form where users update their profile. When a profile is created or updated it creates a CPT called course. The url is the permalink + /course/ + the title of the course /* CREATING ...
user avatar
  • 1
0 votes
1 answer
60 views

Let any visitors delete a post if they know Id nr & password?

I've got only one function left that I need to solve (if it's solvable). I've got a frontend post system for unregistered users. But there are no way for the users to delete a post if they later want....
user avatar
  • 161
5 votes
1 answer
451 views

How to update the delete user confirmation form?

I want to update the confirmation form for delete user. If user has posts, it shows Attribute all content to - option to reassign other author for his posts. It takes lots-of time to load the page, if ...
user avatar
0 votes
0 answers
27 views

How to remove a page in its entirety

I'm having a problem with an unwanted page not disappearing, and continuing to be referenced even when replaced with another page. Here's the situation. I have 2 pages with different versions of the ...
user avatar
  • 3
0 votes
0 answers
469 views

How to optimize wp_delete_post() function, or why it is so slow

I have a code block to delete all the products from a store. This products have several custom fields and some images attached. The code is below: set_time_limit(0); define('WP_USE_THEMES', false); ...
user avatar
2 votes
2 answers
2k views

Before Delete Post

I am trying to update the value of one custom post type's meta when another custom post type is deleted. When a space_rental is deleted, I need to update some meta value on a space. I don't think I ...
user avatar
  • 1,081