Link to home
Start Free TrialLog in
Avatar of steva
steva

asked on

Calling wp_delete_post() from a PHP script

I have a simple, bare-bones PHP script, shown below, that deletes a WordPress post:
User generated image
Line 15 calls the WordPress wp_delete_post() routine to remove the page from WordPress. The code below that removes any images that were uploaded for the page.

The script is called by a $.post call that passes the page id to delete.

The problem I'm having is that PHP complains that wp_delete_post() is undefined. What do I need to declare at the top of my PHP script to expose it?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial