Plugin Directory

Changeset 3348662


Ignore:
Timestamp:
08/22/2025 12:59:31 PM (7 months ago)
Author:
tsinf
Message:

v.10.7 Fix PHP Warning "Undefined Array Key post_type" and fix Bug "Post ID" settings do not hide ID Column

Location:
ts-search-slug
Files:
13 added
3 edited

Legend:

Unmodified
Added
Removed
  • ts-search-slug/trunk/js/backend.js

    r3341948 r3348662  
    33        // Daten, die gesendet werden sollen
    44        var data = {
    5             action: 'tsinf_get_state_list', // Der Action-Name, der in WordPress registriert wird
    6             security: TS_Search_Slug_JS_Obj.nonce, // Das Nonce-Feld für die Sicherheit
     5            action: 'tsinf_get_state_list',
     6            security: TS_Search_Slug_JS_Obj.nonce,
    77        };
    88
     
    3535
    3636        }).fail(function(xhr, status, error) {
    37             // Hier wird ein Fehler verarbeitet
    3837            console.error('Fehler:', error);
    3938        });
  • ts-search-slug/trunk/plugin.php

    r3342238 r3348662  
    77 Author: Tobias Spiess
    88 Author URI: https://www.spiess-informatik.de
    9  Version: 1.0.6
     9 Version: 1.0.7
    1010 Text-Domain: ts-search-slug
    1111 Domain Path: /languages
     
    246246        public static function append_admin_columns($columns) {
    247247            $columns['ts_search_slug_post_name'] = __('Postname/Slug', 'ts-search-slug');
    248             $columns['ts_search_slug_post_id'] = __('ID', 'ts-search-slug');
     248
     249            $all_options = get_option('ts_search_slug_settings');
     250            if(is_array($all_options) && isset($all_options['post_types_id'])) {
     251                $post_type_ids = $all_options['post_types_id'];
     252                if(is_array($post_type_ids) && in_array(get_post_type(), $post_type_ids)) {
     253                    $columns['ts_search_slug_post_id'] = __('ID', 'ts-search-slug');
     254                }
     255            }
    249256       
    250257            return $columns;
     
    278285        public static function make_custom_columns_sortable($columns) {
    279286            $columns['ts_search_slug_post_name'] = 'post_name';
    280             $columns['ts_search_slug_post_id'] = 'ID';
    281        
     287           
     288            $all_options = get_option('ts_search_slug_settings');
     289            if(is_array($all_options) && isset($all_options['post_types_id'])) {
     290                $post_type_ids = $all_options['post_types_id'];
     291                if(is_array($post_type_ids) && in_array(get_post_type(), $post_type_ids)) {
     292                    $columns['ts_search_slug_post_id'] = 'ID';
     293                }
     294            }
     295
    282296            return $columns;
    283297        }
     
    298312
    299313            if(!is_string($post_type) || (is_string($post_type) && strlen($post_type) < 1)) {
    300                 $post_type = $wp_query->query['post_type'];
     314                $post_type = (isset($wp_query->query['post_type'])) ? $wp_query->query['post_type'] : '';
    301315            }
    302316
     
    355369            }
    356370
    357 
     371           
    358372           
    359373            return $where;
  • ts-search-slug/trunk/readme.txt

    r3342246 r3348662  
    3232
    3333== Changelog ==
     34### 1.0.7
     35- Fix PHP Warning "Undefined Array Key post_type"
     36- Fix Bug "Post ID" settings do not hide ID Column
     37
    3438### 1.0.6
    3539- Clean up code
Note: See TracChangeset for help on using the changeset viewer.