Support » Plugin: All in One SEO Pack » Notice: Undefined variable: post_type in after installing AIOSEO

  • Resolved mksindi

    (@mksindi)


    Hello

    After installation of plugin AIOSEO I am getting this notice

    Notice: Undefined variable: post_type in C:\Inetpub\vhosts\mysite\httpdocs\wp-content\plugins\all-in-one-seo-pack\aioseop_class.php on line 4249.

    How to fix this error. I suppose due to this error I am also facing issue related to OG:image error

    Provided og:image URL, https://www.mysite/wp-content/uploads/2019/04/xyz.png could not be processed as an image because it has an invalid content type.

    Can you please help me out to fix this issue.

    I tried various option to solve this issue.

    1. deactivate all plugins except AIOSEO
    2. changed themes
    3. debuging through facebook developer

    but didn’t get resolve the issue.

    Plz help

    Thanks & Regards
    Mks

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    Thanks for reporting this. We’re aware of this and are working on a fix.
    However, it’s only a notice so you can safely ignore it. Make sure to turn off debug mode on your production site.

    Peter Smits

    (@psmits1567)

    Hi Michael

    Same problem at my site already reported by me, but still no solution!
    If I add the following on line 4246 the error is no longer present !
    $post_type = get_post_type();
    Regards,
    Peter

    Hi

    Issue still not resolved !!
    post_type in /www/wp-content/plugins/all-in-one-seo-pack/aioseop_class.php on line 3983
    After updating to the latest version today, the line number has changed !
    I am using Versie: 3.0.1

    Regards,
    Peter

    Plugin Contributor arnaudbroes

    (@arnaudbroes)

    @psmits1567 this is on our roadmap but we’re still working out the details. We’ll look into the fix you’ve suggested earlier. You can get rid of this notice for now by setting ‘WP_DEBUG’ to ‘false’ in your wp-config.php file.

    Hi Arnaud,

    Thanks for your quick reply.
    I do not want to set debug to false, because I am following other errors.
    I know it does not disturb the site, but wanted to let you know the error is still present.
    Regards,
    Peter

    I was getting this bug on a different line than the original post, can confirm that it has crawled over to line 3983.

    As a lazy fix, I suggest putting the @ symbol before the $post_type variable and then maybe that will solve the problem for now?

    ( ( '' === $aiosp_nofollow ) && ( ! empty( $aioseop_options['aiosp_cpostnofollow'] ) ) && in_array( @$post_type, $aioseop_options['aiosp_cpostnofollow'] ) )

    This may or may not work for you, but at the moment I seem to have swatted that bug.

    Hi

    I have replied to another report for this problem
    My solution is the following
    aioseop_class.php on line 3983
    function get_robots_meta() {
    global $aioseop_options;
    $opts = $this->meta_opts;
    $page = $this->get_page_number();
    $robots_meta = $tax_noindex = ”;
    ———————————
    //PSS populate post type
    $post = $this->get_queried_object();
    $post_type = ”;
    if ( ! empty( $post ) && ! empty( $post->post_type ) ) {
    $post_type = $post->post_type;
    }
    ———————————

    After adding these lines the problem is no longer present
    Hope this helps solving the problem
    In case of a post_type “page” you do not get a pagenumber on my site
    In case of a post_type “post” you do get a pagenumber
    So somehow the $post_type is lost locally

    Regards,
    Peter

    Plugin Contributor arnaudbroes

    (@arnaudbroes)

    @psmits1567 as mentioned here (https://wordpress.org/support/topic/aioseop_class-php-on-line-3983/#post-11688237), a fix for this should be included in the upcoming 3.2 release.

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.