Questions tagged [wp-delete-post]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-1 votes
1 answer

Function to delete post from category older than 2 days

I was referring to What would be a PHP command to erase all posts from category X from the last month? from 2017 to delete old post from a category. When I implemented it, it is deleting newest 1 day ...
apptikka's user avatar
0 votes
0 answers

Delete data from the database on a table row on clicking delete button

So I have this custom table which displays data from database upon form submission on a custom plugin I'm building. I would like to add a functionality on the delete button to be able to delete each ...
Paul Smith's user avatar
0 votes
0 answers

Frontend redirect after delete post in wordpress

I'm using the following link to delete a post in the frontend of wordpress: function wp_delete_post_link($link = 'Delete', $before = '', $after = '') { global $post; if ( $post->post_type == 'page' ...
Tyler's user avatar
  • 1
0 votes
0 answers

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" ...
Raging Vids's user avatar
1 vote
1 answer

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 ...
JonatanPN's user avatar
0 votes
1 answer

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( ...
Rafa Carvalhido's user avatar
-1 votes
2 answers

How to Delete Posts by title?

I have about 2000 titles. How can I automatically delete posts with these titles? For example
Batuhan Aygun's user avatar
0 votes
1 answer

`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->...
Aram Hovhannisyan's user avatar
0 votes
1 answer

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 ...
Cinnia Entertainment's user avatar
0 votes
1 answer

$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: $...
Bryan's user avatar
  • 41
0 votes
1 answer

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

I've 2 almost identical posts: I ...
Igor Savinkin's user avatar
0 votes
1 answer

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 ...
CaptainNemo's user avatar
0 votes
2 answers

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 ...
Zaesar's user avatar
  • 101
0 votes
1 answer

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....
JoBe's user avatar
  • 171
5 votes
1 answer

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 ...
Hasmukh Kalsariya's user avatar
0 votes
0 answers

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 ...
clg's user avatar
  • 3
0 votes
0 answers

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); ...
Kevin Mamaqi's user avatar
2 votes
2 answers

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 ...
Eckstein's user avatar
  • 1,099