• Resolved petersweater

    (@petersweater)


    Hello Andrew.

    Thanks for “Admin Search”, it’s very nice plugin.

    I make some little changes:

    • fix PHP8 error (Fatal error: Uncaught Error: Unsupported operand types: string * int in /bitnami/wordpress/wp-content/plugins/admin-search/ajax.php on line 548)
    • add wp_block post_type

    Can you include these changes?

    fix PHP8 error:

    Index: trunk/ajax.php
    ===================================================================
    --- trunk/ajax.php      (revision 3006683)
    +++ trunk/ajax.php      (working copy)
    @@ -545,7 +545,7 @@
                            'taxonomy'              =>      $taxonomy,
                            'hide_empty'    =>      false,
                            'number'                =>      admin_search_setting( 'result_count' ),
    -                       'offset'                =>      ( $paged - 1 ) * admin_search_setting( 'result_count' )
    +                       'offset'                =>      (int) ( $paged - 1 ) * (int) admin_search_setting( 'result_count' )
                    );
    
                    // If q is an ID, only look for the term with that ID, otherwise, pass q to the name__like argument

    add wp_block post_type:

    Index: trunk/settings.php
    ===================================================================
    --- trunk/settings.php  (revision 3006683)
    +++ trunk/settings.php  (working copy)
    @@ -556,7 +556,7 @@
            echo "<div id='admin_search_plugin_setting_post_types'>";
    
            foreach ( get_post_types( array(), 'object' ) as $post_type ) {
    -               if ( $post_type -> {'public'} ) {
    +               if ( $post_type -> {'public'} || $post_type -> name === 'wp_block' ) {
                            echo "<p><label><input type='checkbox' name='admin_search_settings[post_types][]' value='{$post_type -> name}'";
    
                            if ( in_array( $post_type -> name, admin_search_setting( 'post_types', array() ) ) ) {
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘fix PHP8 error and add wp_block post_type’ is closed to new replies.