6/1/2017 - 9:28 AM

Caricare WP dentro pagina HTML evitando errore 404

Caricare WP dentro pagina HTML evitando errore 404

//Invece di usare 



$wp->init(); $wp->parse_request(); $wp->query_posts();
$wp->register_globals(); $wp->send_headers();

From the documentation:

init() — set up the current user.
parse_request() — Parse request to find correct WordPress query.
query_posts() — Set up the Loop based on the query variables.
register_globals() — Set up the WordPress Globals.
send_headers() — Sets the X-Pingback header, 404 status (if 404), Content-type. If showing a feed, it will also send last-modified, etag, and 304 status if needed.
And obviously, we’re leaving out handle_404().

handle_404() — Issue a 404 if a request doesn’t match any posts and doesn’t match any object (e.g. an existing-but-empty category, tag, author) and a 404 was not already issued, and if the request was not a search or the homepage. Otherwise, issue a 200.
Now, our pages work as expected.