[wp-trac] [WordPress Trac] #24786: filter set-screen-option not triggering

WordPress Trac noreply at wordpress.org
Mon Sep 16 23:56:38 UTC 2013


#24786: filter set-screen-option not triggering
--------------------------+------------------------------
 Reporter:  robbcaldwell  |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  3.5.2
 Severity:  normal        |  Resolution:
 Keywords:  close         |
--------------------------+------------------------------
Changes (by DrewAPicture):

 * keywords:   => close


Comment:

 I think this is expected behavior -- that the filter defaults to false.

 Also, is there a particular reason why you're adding the filter right
 after adding the screen option?

 I only ask because moving the `add_filter()` call outside of
 `add_options()` works and saves as expected for me, with `add_options()`
 hooked to the `in_admin_header` action.

 {{{
 #!php
 function add_options() {
         $option = 'per_page';

         $args = array(
                 'label' => 'Properties',
                 'default' => 20,
                 'option' => 'my_custom_per_page'
         );

         add_screen_option( $option, $args );
 }
 add_action( 'in_admin_header', 'add_options' );

 function my_custom_set_option( $status, $option, $value ) {
         return $value;
 }
 add_filter( 'set-screen-option', 'my_custom_set_option', 10, 3 );
 }}}

--
Ticket URL: <http://core.trac.wordpress.org/ticket/24786#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list