chore(wpmc S2): defensive defines + PostType::SLUG refs + stale comment
Wrap 4 define() calls with defined() || guards to survive double-load. Replace hardcoded 'shortcode-town' strings in Taxonomy and FieldGroup with PostType::SLUG. Update Activator comment to reflect S2 reality. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,8 @@ final class Activator
|
|||||||
{
|
{
|
||||||
public static function activate(): void
|
public static function activate(): void
|
||||||
{
|
{
|
||||||
// Stage 2 will register taxonomy + CPT; flush after they're declared.
|
// S2 registrations use rewrite=false; flush is harmless and
|
||||||
|
// forward-compatible with the S4 URL router.
|
||||||
flush_rewrite_rules();
|
flush_rewrite_rules();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ final class FieldGroup
|
|||||||
],
|
],
|
||||||
'location' => [
|
'location' => [
|
||||||
[
|
[
|
||||||
['param' => 'post_type', 'operator' => '==', 'value' => 'shortcode-town'],
|
['param' => 'post_type', 'operator' => '==', 'value' => PostType::SLUG],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'menu_order' => 0,
|
'menu_order' => 0,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ final class Taxonomy
|
|||||||
|
|
||||||
public static function do_register(): void
|
public static function do_register(): void
|
||||||
{
|
{
|
||||||
register_taxonomy(self::SLUG, ['shortcode-town'], [
|
register_taxonomy(self::SLUG, [PostType::SLUG], [
|
||||||
'labels' => [
|
'labels' => [
|
||||||
'name' => __('Города', 'wp-multi-city'),
|
'name' => __('Города', 'wp-multi-city'),
|
||||||
'singular_name' => __('Город', 'wp-multi-city'),
|
'singular_name' => __('Город', 'wp-multi-city'),
|
||||||
|
|||||||
+4
-4
@@ -14,10 +14,10 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
if (!defined('ABSPATH')) exit;
|
if (!defined('ABSPATH')) exit;
|
||||||
|
|
||||||
define('WPMC_PLUGIN_FILE', __FILE__);
|
defined('WPMC_PLUGIN_FILE') || define('WPMC_PLUGIN_FILE', __FILE__);
|
||||||
define('WPMC_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
defined('WPMC_PLUGIN_DIR') || define('WPMC_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
||||||
define('WPMC_PLUGIN_URL', plugin_dir_url(__FILE__));
|
defined('WPMC_PLUGIN_URL') || define('WPMC_PLUGIN_URL', plugin_dir_url(__FILE__));
|
||||||
define('WPMC_VERSION', '0.1.0');
|
defined('WPMC_VERSION') || define('WPMC_VERSION', '0.1.0');
|
||||||
|
|
||||||
require_once WPMC_PLUGIN_DIR . 'includes/class-plugin.php';
|
require_once WPMC_PLUGIN_DIR . 'includes/class-plugin.php';
|
||||||
\WPMultiCity\Plugin::register_autoloader();
|
\WPMultiCity\Plugin::register_autoloader();
|
||||||
|
|||||||
Reference in New Issue
Block a user