So, I deleted multiple post of type page (sent them to trash, went to trash and permanently deleted them), but one of my functions didn’t work like it was supposed to so I went and investigated, it was because the post_exists( $slug , '', '', 'page')
returned a truthy value.
For example just to test it, for
require_once( ABSPATH . 'wp-admin/includes/post.php' );
echo post_exists( 'home', '', '', 'page');
it echoed 363
, so I went to the database to check and found that not only is it not deleted per se, but it appears as published:
mysql> SELECT ID, post_name, post_title, post_status, post_type FROM wordpress.wp_posts WHERE ID=3
63;
+-----+-----------+------------+-------------+-----------+
| ID | post_name | post_title | post_status | post_type |
+-----+-----------+------------+-------------+-----------+
| 363 | home | Home | published | page |
+-----+-----------+------------+-------------+-----------+
1 row in set (0.00 sec)
I know I’m probably overlooking a fundamental and basic thing about how wordpress works, but I didn’t find anything useful while searching for this.
So, how can I delete posts definitively without actually going to the database and deleting it?