WordPress.org

Forums

Custom Sidebars
[resolved] Small check to avoid Notice (5 posts)

  1. rafaang
    Member
    Posted 1 year ago #

    Hi!

    Just a small mod to avoid Notice due to not set $post->ID.

    Change the function storeOriginalPostId() by this one with one additional line:

    function storeOriginalPostId(){
    		global $post;
    		if(isset($post->ID))
    			$this->originalPostId = $post->ID;
    	}

    Kind Regards,
    Rafael

    https://wordpress.org/plugins/custom-sidebars/

  2. David
    WPMU DEV Support Staff
    Posted 1 year ago #

    Hi there Rafael,

    I'm very sorry for the delay in replying here. And of course, thanks for posting this. Could I ask under what circumstances you're seeing a notice regarding the post ID?

    I think I may be a bit confused with this but if you could let me know where that would apply, I'll gladly run this by the developers to see about getting it implemented. :)

    Thanks,
    David

  3. rafaang
    Member
    Posted 1 year ago #

    Hey David.

    It's issue that happens in 404 pages. I don't know if it's a thing related to WordPress core or if the developers should verify the vars.

    Sure that I'm using WP_DEBUG and STRICT PHP with ALL_ERRORS, WARNINGS and NOTICES output. In a usual user installation, nothing should happen.

    Thank you for the reply and for your time!

    Rafael

  4. WPMU DEV
    Member
    Plugin Contributor

    Posted 1 year ago #

    Hi Rafael,

    Thank you for your reply.

    I could reproduce the following notice on 404 not found page and confirmed your solution fixed it.

    Notice: Trying to get property of non-object in ..\wp-content\plugins\custom-sidebars\customsidebars.php on line 294

    I have notified the plugin developer to apply this fix in the plugin code.

    Thank you for sharing the solution in the community and spreading the awesomeness!

    Your help is really appreciated.

    Have a great day!

    Cheers,
    WPMU DEV

  5. WPMU DEV
    Member
    Plugin Contributor

    Posted 1 year ago #

    Hi Rafael,

    I hope you are well today.

    It is fixed in the latest version of Custom sidebars plugin.

    Cheers,
    WPMU DEV

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Sidebars
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.