Viewing 8 posts - 1 through 8 (of 8 total)
  • #241341
    jsjc
    Member
    Post count: 54

    I get an error on 404 pages, then a second after it redirects to a page with no error…

    Notice: Trying to get property of non-object in /var/www/wp-content/themes/neighborhood/header.php on line 20

    You can check by yourself in the url provided.

    Thanks!

    #241346
    David Martin – Support
    Moderator
    Post count: 20834

    Hi,

    I am not seeing any 404’s whilst browsing your site.

    Can you clear your cache and any caching plugins you maybe using?

    If the issue persists, please supply me another URL that generates a 404 error.

    Thanks.

    #241378
    jsjc
    Member
    Post count: 54
    This reply has been marked as private.
    #241398
    David Martin – Support
    Moderator
    Post count: 20834

    It’s not clear what you are referring to, please provide a specific URL.

    – Are you stating you see 404 errors on your pages when using the site?
    – Or an error on the 404 page WP displays?

    Thanks,.

    #241434
    jsjc
    Member
    Post count: 54

    An error that displays on a 404 page.

    #241440
    David Martin – Support
    Moderator
    Post count: 20834

    Ok, please test this:

    1) Open header.php and locate this:

    				if ( ( function_exists('is_shop') && is_shop() ) || ( function_exists('is_product_category') && is_product_category() ) ) {
    					$post_id = wc_get_page_id( 'shop' );
    				} else {
    					$post_id = $post->ID;
    				}

    Please replace it with this:

    			if ( !is_404() ) {
    				if ( ( function_exists('is_shop') && is_shop() ) || ( function_exists('is_product_category') && is_product_category() ) ) {
    					$post_id = wc_get_page_id( 'shop' );
    				} else {
    					$post_id = $post->ID;
    				}
    			}

    Thanks,
    David

    #241461
    jsjc
    Member
    Post count: 54

    OK fixed now.

    Make sure you put it on next update so nobody has issue and will not overwrite my current headers.php

    Thanks!

    #241470
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Ok no problem

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register