WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#47214 closed defect (bug) (invalid)

Adding new menu entries fails

Reported by: theincogtion Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Menus Keywords:
Focuses: Cc:

Description

I activated debug mode and tried to add an individual link to my top menu which resulted in:

[10-May-2019 10:17:15 UTC] PHP Warning: Invalid argument supplied for foreach() in /mnt/web318/b1/45/58782945/htdocs/WordPress_SecureMode_01/wp-includes/wp-db.php on line 2363

(nothing is added to the menu)

The content of wp-db.php at line 2363

<?php
foreach ( $data as $field => $value ) {

context:

<?php
/**
         * Prepares arrays of value/format pairs as passed to wpdb CRUD methods.
         *
         * @since 4.2.0
         *
         * @param array $data   Array of fields to values.
         * @param mixed $format Formats to be mapped to the values in $data.
         * @return array Array, keyed by field names with values being an array
         *               of 'value' and 'format' keys.
         */
        protected function process_field_formats( $data, $format ) {
                $formats = $original_formats = (array) $format;

                foreach ( $data as $field => $value ) {
                        $value = array(
                                'value'  => $value,
                                'format' => '%s',
                        );

                        if ( ! empty( $format ) ) {
                                $value['format'] = array_shift( $formats );
                                if ( ! $value['format'] ) {
                                        $value['format'] = reset( $original_formats );
                                }
                        } elseif ( isset( $this->field_types[ $field ] ) ) {
                                $value['format'] = $this->field_types[ $field ];
                        }

                        $data[ $field ] = $value;
                }

                return $data;
        }

Health summary:
https://pastebin.com/JWptWjkk

Change History (3)

#1 @earnjam
2 years ago

  • Keywords reporter-feedback added
  • Version 5.2 deleted

Hi @theincogtion and welcome to WordPress Trac!

Can you try deactivating the plugins and switching to the default theme and confirming this is still an issue? I suspect it's one of your plugins causing the problem and not core, but don't want to close this ticket until we confirm that. Thanks!

#2 @theincogtion
2 years ago

@earnjam thanks for the feedback.
I used the troubleshooting mode and I could edit the menu thanks so far.
Does not look like a core problem.

#3 @earnjam
2 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.