Support » Plugin: AMP » Line error shown with WP_debug

  • Resolved Jonah Brown


    Warning: date() expects parameter 2 to be integer, string given in /www/wp-content/plugins/amp/includes/amp-helper-functions.php on line 659

    I recieved errors from Google Webmaster about AMP errors shortly after enabling WP_debug, Can you look into to this error?


    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Weston Ruter


    This is the line in question:

    Please try to find out what get_the_date( 'U', $post->ID ) is returning.

    The issue is also happening down in the post further:

    Warning: A non-numeric value encountered in /www/wp-includes/formatting.php on line 3237 49 years ago

    So I believe the issue is that your underlying post or page has an empty post_date, or you may have a get_the_date a filter that is causing the problem.

    Jonah Brown


    Thanks found this code snippet

    function et_last_modified_date_blog( $the_date ) {
        if ( 'post' === get_post_type() ) {
            $the_time = get_post_time( 'His' );
            $the_modified = get_post_modified_time( 'His' );
            $last_modified =  sprintf( __( 'Last updated %s', 'Divi' ), esc_html( get_post_modified_time( 'M j, Y' ) ) );
            $published =  sprintf( __( 'Published on %s', 'Divi' ), esc_html( get_post_time( 'M j, Y' ) ) );
            $date = $the_modified !== $the_time ? $last_modified . ' | ' .  $published : $published;
            return $date;
    add_action( 'get_the_date', 'et_last_modified_date_blog' );
    add_action( 'get_the_time', 'et_last_modified_date_blog' );

    Is there a condition I can use to have this turn off for AMP?

    Plugin Author Weston Ruter


    Your snippet should look like this instead:

    It is important to always return a value from a filter and in the case of filtering the date, never modify it if the Unix timestamp (the integer of seconds since 1970) is requested.

    Jonah Brown


    Thanks for helping with this, I also found the templates folder in your plugin. Which is perfect since I wanted to change what the text says as well 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Line error shown with WP_debug’ is closed to new replies.