0
votes

I have a website that runs Wordpress and I have just started studying php, because I need to retrieve some data from my database for certain purposes.

I'm trying to show the posts of the day in a list, with: 'post_title', 'post_name' and 'post_date' only if 'post_status' is 'publish'. I need to show it in a new page. This new page is loaded in the public_html.

I have tried to follow the rules of $wpdb, but I didn't get anything. Then, I have found that I need to require wp-load to have everything work fine.

The problem is this: when I try to require_once('wp-load.php'); I have a blank page. I tried to echo something before and after it to debug: before everything works, after anything.

The code is really simple:

<?php

    echo "test1";

    require_once('wp-load.php');

    echo "test2";

?>

This is what I get:

test1��).H̳��S�:6

My file and wp-load.php are on the same level.

1

1 Answers

0
votes

I have solved adding SHORTINIT before the statement:

    define( 'SHORTINIT', true );
    require('wp-load.php');