• Resolved pkrynauw

    (@pkrynauw)


    I get the following error when going to Appearance/Menus: “Attempt to assign property “posts_page” on null”

    I can reach Menus via Customizer.

    The menu issue is linked to the “Blog” post.

    I switched themes and tested plugins, but can not solve the problem. I deleted the Blog post and reloaded a page but the error message does not go away. 

    In Troubleshooting mode the Appearance/Menus message is: “There has been n critical error on this website”

    Can the error be from one of the WordPress core files? 

    When will the next update be released?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    “a critical error”

    Errors like this are logged. Check the error log on your server. If you can’t find the log, please contact your host.

    Meantime, enable wp_debug and wp_debug_log and after an error, look at wp-content/debug.log to see if anything gets logged there. https://www.ads-software.com/support/article/debugging-in-wordpress/

    You can also try this: Please attempt to disable all plugins, and use one of the default (Twenty*) themes. If the problem goes away, enable them one by one to identify the source of your troubles.

    If you cannot access wp-admin, there are other ways to deactivate plugins:  https://www.ads-software.com/support/article/faq-troubleshooting/#how-to-deactivate-all-plugins-when-not-able-to-access-the-administrative-menus

    Thread Starter pkrynauw

    (@pkrynauw)

    This is what I find in Debug log manager when site is in Troubleshooting mode and I click Menus via Appearance:

    PHP Fatal Uncaught Error: Attempt to assign property “posts_page” on null
    Stack trace: 0 /wp-admin/includes/template.php(1577): wp_nav_menu_item_post_type_meta_box(NULL, Array) 1 /wp-admin/nav-menus.php(984): do_accordion_sections(Object(WP_Screen), ‘side’, NULL) 2 {main} thrown in /wp-admin/includes/nav-menu.php on line 406

    WordPress core
    File: /wp-admin/includes/nav-menu.php
    Line: 406

    Advice will be appreciated

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    I was hoping for more debug entries than that. Well, then, on to more troubleshooting. This may be a plugin or theme conflict. Please attempt to disable all plugins, and use one of the default (Twenty*) themes. If the problem goes away, enable them one by one to identify the source of your troubles.

    Thread Starter pkrynauw

    (@pkrynauw)

    Thanks for your feedback. I did your troubleshooting and when all plugins are disabled and Twenty theme active I get the debug entry as shown in my earlier message. I have more than 100 log entries since this morning- -php deprecated, php warnings, etc. Examples- 36 of each of:

    PHP Warning Undefined array key “file”
    WordPress core
    File: /wp-includes/media.php
    Line: 1373

    PHP Deprecatedstrpos(): Passing null to parameter #1 ($haystack) of type string is deprecatedWordPress core
    File:?/wp-includes/media.php
    Line: 1373

    Plugin related example- 116 occurrences

    PHP Deprecated Automatic conversion of false to array is deprecated
    Plugin: WP Super Cache
    File: /wp-content/plugins/wp-super-cache/wp-cache-phase2.php
    Line: 984

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    The problem is that that’s where the error is being detected, not where it’s caused.

    Long shot: Go to DASHBOARD -> UPDATES and click the button to reinstall WP. That will replace the files and make sure you have a consistent set. (You will not lose any data.)

    Thread Starter pkrynauw

    (@pkrynauw)

    I did the WP reinstall, but the Appearance/Menus error “Attempt to assign property “posts_page” on null” does not go away. Debug log shows lots of “PHP deprecated” items also “PHP warnings”. “Fatal PHP” messages on log are:

    [24-Jul-2023 07:10:43 UTC] PHP Fatal error Cannot declare class Debug_Bar, because the name is already in use

    [24-Jul-2023 08:28:18 UTC]?PHP Fatal error?Uncaught Error: Attempt to assign property “posts_page” on null?

    [25-Jul-2023 16:27:26 UTC]?PHP Fatal error?Allowed memory size of 536870912 bytes exhausted (tried to allocate 1052672 bytes)?(This is linked to a backup)

    Further suggestions will be appreciated

    This is a known issue, that will be fixed in WordPress 6.3. This is the ticket:

    https://core.trac.www.ads-software.com/ticket/58345

    To fix this right now, you would need to make a change in the database in the wp_options table. Look for the option_key with the name page_for_posts and change the value to 0 after which you should be able to change your settings again via your dashboard.

    Thread Starter pkrynauw

    (@pkrynauw)

    Hi Jos, Thank you for the assistance. Problem solved. I could not find the name “page_for_posts” but found “posts_per_page” with a value of 10 which we changed to 0.

    Glad to hear it’s solved, but that other setting should not be changed. It’s the number of posts that’s shown on a blog page.

    If page_for_posts is not available, it might also be the option page_on_front.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Appearance/menus error’ is closed to new replies.