• Resolved yashbee

    (@yashbee)


    I am using WP_Query for accessing a custom post type. Here is the code:

    <?php
    	
    	$args = array(
    		'post_type' => 'family-members',
    		'posts_per_page' => -1
    	);
    	
    	$the_query = new WP_Query( $args );
    
    ?>

    This code was working fine for couple of years. I don’t know why it broke this way. May be after I updated WP version, or the plugins. Can’t say for sure.
    The page only displays half the content and source code ends abruptly when checked in the browser. The background should be white and there is a whole right column with links and menu.
    Check here: maheshseva.com

    PS: WP_Query for the same CPT is working on some other page. Also, the site works fine on my local machine. Happy to share any additional information you need.

    • This topic was modified 9 years ago by yashbee.
Viewing 5 replies - 1 through 5 (of 5 total)
  • codismo

    (@codismo)

    It’s something related to the #birthday section.

    Set WP_DEBUG to true in wp-config.php, it should show the exact error.

    If it does not then add this in wp-config.php ( where WP_DEBUG is located ):

     // Enable WP_DEBUG mode
    define( 'WP_DEBUG', true );
    
    // Enable Debug logging to the /wp-content/debug.log file
    define( 'WP_DEBUG_LOG', true );
    
    // Disable display of errors and warnings 
    define( 'WP_DEBUG_DISPLAY', false );
    @ini_set( 'display_errors', 0 );
    
    // Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
    define( 'SCRIPT_DEBUG', true );

    Then load the page and after you do go to the wp-content folder and open up the debug.log file, the error will show up there.

    Thread Starter yashbee

    (@yashbee)

    The error log says:

    [07-May-2017 13:04:39 UTC] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 2097152 bytes) in /home/**/public_html/wp-includes/wp-db.php on line 2416

    codismo

    (@codismo)

    Thread Starter yashbee

    (@yashbee)

    Thank you!

    codismo

    (@codismo)

    You’re welcome.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘WP_Query with custom post type in args stopped working’ is closed to new replies.