I realized that I was trying to delete a post while my current site wasn’t the same one. My WordPress is multisite.
switch_to_blog($siteId);
solved the issue.
I realized that I was trying to delete a post while my current site wasn’t the same one. My WordPress is multisite.
switch_to_blog($siteId);
solved the issue.