| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Post Category Filter (WP Admin) |
| 4 |
* Plugin URI: https://infinitumform.com/projects/admin-category-filter |
| 5 |
* Description: Quickly search and filter categories and taxonomies inside the WordPress admin. |
| 6 |
* Version: 1.7.5 |
| 7 |
* Requires at least: 6.0 |
| 8 |
* Requires PHP: 7.4 |
| 9 |
* Author: Ivijan Stefan Stipic |
| 10 |
* Author URI: https://www.linkedin.com/in/ivijanstefanstipic/ |
| 11 |
* License: GPLv2 or later |
| 12 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 13 |
* Text Domain: admin-category-filter |
| 14 |
* Domain Path: /languages |
| 15 |
* |
| 16 |
* ------------------------------------------------------------------------ |
| 17 |
* This plugin is a maintained continuation (adoption) of the original |
| 18 |
* "Post Category Filter" plugin created by Javier Villanueva (jahvi). |
| 19 |
* |
| 20 |
* Copyright (c) 2013-2018 Javier Villanueva (Original Author) |
| 21 |
* Copyright (c) 2025 Ivijan Stefan Stipic (Maintainer) |
| 22 |
* ------------------------------------------------------------------------ |
| 23 |
* |
| 24 |
* This program is free software; you can redistribute it and/or modify |
| 25 |
* it under the terms of the GNU General Public License as published by |
| 26 |
* the Free Software Foundation; either version 2 of the License, or |
| 27 |
* (at your option) any later version. |
| 28 |
*/ |
| 29 |
|
| 30 |
// Exit if accessed directly. |
| 31 |
if ( ! defined( 'ABSPATH' ) ) { |
| 32 |
exit; |
| 33 |
} |
| 34 |
|
| 35 |
// Define constants. |
| 36 |
if ( ! defined( 'APCF_VERSION' ) ) { |
| 37 |
define( 'APCF_VERSION', '1.7.5' ); |
| 38 |
} |
| 39 |
|
| 40 |
if ( ! defined( 'APCF_PLUGIN_FILE' ) ) { |
| 41 |
define( 'APCF_PLUGIN_FILE', __FILE__ ); |
| 42 |
} |
| 43 |
|
| 44 |
if ( ! defined( 'APCF_PLUGIN_DIR_PATH' ) ) { |
| 45 |
define( 'APCF_PLUGIN_DIR_PATH', plugin_dir_path( __FILE__ ) ); |
| 46 |
} |
| 47 |
|
| 48 |
if ( ! defined( 'APCF_PLUGIN_BASENAME' ) ) { |
| 49 |
define( 'APCF_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
| 50 |
} |
| 51 |
|
| 52 |
if ( ! defined( 'APCF_PLUGIN_URL' ) ) { |
| 53 |
define( 'APCF_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
| 54 |
} |
| 55 |
|
| 56 |
// Load text domain. |
| 57 |
function pcf_load_textdomain() { |
| 58 |
// Third argument MUST be relative path from WP_PLUGIN_DIR. |
| 59 |
load_plugin_textdomain( |
| 60 |
'admin-category-filter', |
| 61 |
false, |
| 62 |
dirname( APCF_PLUGIN_BASENAME ) . '/languages' |
| 63 |
); |
| 64 |
} |
| 65 |
add_action( 'plugins_loaded', 'pcf_load_textdomain' ); |
| 66 |
|
| 67 |
// Only load in admin screens (non-AJAX bootstrap). |
| 68 |
if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) { |
| 69 |
$pcf_class_file = APCF_PLUGIN_DIR_PATH . 'inc/class-category-filter.php'; |
| 70 |
|
| 71 |
// Prevent fatal error if the file is missing during update or partial install. |
| 72 |
if ( file_exists( $pcf_class_file ) ) { |
| 73 |
require_once $pcf_class_file; |
| 74 |
|
| 75 |
if ( class_exists( 'Post_Category_Filter' ) ) { |
| 76 |
add_action( |
| 77 |
'plugins_loaded', |
| 78 |
array( 'Post_Category_Filter', 'get_instance' ) |
| 79 |
); |
| 80 |
} |
| 81 |
} else { |
| 82 |
error_log( '[Admin Category Filter] class-category-filter.php not found at: ' . $pcf_class_file ); |
| 83 |
} |
| 84 |
} |