How to create a 'Fake' WordPress post on the fly | Barn2 Plugins

Recently, while making updates to our WooCommerce Private Store plugin, I needed to find a way to create a WordPress page in code which doesn't exist in the database. All WordPress posts (and pages) live in the database in the

Step 1 - Creating the fake post. First of all, you'll need to create a dummy WP_Post object. Looking at the constructor for WP_Post, we'll see ...

Lee mas