Opened 3 years ago

Closed 3 years ago

#12439 closed defect (bug) (fixed)

Metaboxes options ignored

Reported by: scribu Owned by:
Priority: normal Milestone: 3.0
Component: Administration Version: 3.0
Severity: major Keywords: has-patch tested commit
Cc: WordPress@…

Description

Steps to reproduce

On any admin page with meta boxes:

  1. Open Screen Options.
  1. Uncheck one of the metabox titles, to hide it.
  1. Refresh page.

Expected result

Box stays hidden.

Actual result

Hidden metaboxes are reset to default values.

Attachments (4)

12439.diff (1.1 KB) - added by scribu 3 years ago.
Add $wpdb->prefix.
12439.2.diff (1.8 KB) - added by scribu 3 years ago.
use update_user_option() instead of update_user_meta()
12439.3.diff (1.9 KB) - added by scribu 3 years ago.
Remove $option = preg_replace('|[a-z0-9_]|i', , $option);
12439.4.diff (5.7 KB) - added by scribu 3 years ago.
take care of custom post types

Download all attachments as: .zip

Change History (15)

I've traced the error to get_hidden_meta_boxes() -> get_user_option().

scribu3 years ago

Add $wpdb->prefix.

  • Keywords has-patch added; needs-patch removed

The problem was that get_user_option() first looks for blog-specific options, but the AJAX calls updated the user-specific options.

12439.diff fixes this.

scribu3 years ago

use update_user_option() instead of update_user_meta()

scribu3 years ago

Remove $option = preg_replace('|[a-z0-9_]|i', , $option);

12439.2.diff uses update_user_option(), making it compatible with get_user_option().

12439.3.diff takes a more "radical" approach and removes the $option = preg_replace('|[^a-z0-9_]|i', '', $option); filter. It has the short-term drawback that users will loose their customizations when upgrading.

  • Keywords tested added
  • Keywords tested removed

scratch that, its working on the dashboard and built in edit pages, but not on custom post_type pages.

  • Summary changed from Hidden metaboxes options ignored to Metaboxes options ignored

scribu3 years ago

take care of custom post types

With 12439.4.diff metaboxes on editing screens other than posts should work too.

  • Keywords tested added

That patch seems to have fixed the custom post_types now.

  • Cc WordPress@… added
  • Keywords commit added
  • Resolution set to fixed
  • Status changed from new to closed

(In [13551]) Fix metabox hiding. Props scribu. fixes #12439

Note: See TracTickets for help on using tickets.