Skip to content

Commit d56fec3

Browse files
authored
Merge pull request #93 from sectsect/bugfix/92-bugfix
refactor(admin-script): remove redundant wp_die() for taxonomy valida…
2 parents 9fed321 + 25db727 commit d56fec3

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

includes/index.php

+3-12
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ function load_wpto_admin_script( string $hook ): void {
221221

222222
$pt = wto_has_tag_posttype();
223223

224-
// Early validation and error handling.
224+
// Early validation and error handling for unsupported post types.
225225
if ( ! in_array( $post->post_type, $pt, true ) ) {
226226
wp_die(
227227
esc_html(
@@ -238,18 +238,9 @@ function load_wpto_admin_script( string $hook ): void {
238238

239239
$taxonomies_attached = get_object_taxonomies( $post->post_type );
240240

241+
// Simply return if no enabled taxonomies are found.
241242
if ( ! wto_has_enabled_taxonomy( $taxonomies_attached ) ) {
242-
wp_die(
243-
esc_html(
244-
sprintf(
245-
/* translators: %s: Post type name */
246-
__( 'No enabled taxonomies found for post type "%s".', 'wp-tag-order' ),
247-
esc_html( $post->post_type )
248-
)
249-
),
250-
esc_html__( 'WP Tag Order Error', 'wp-tag-order' ),
251-
array( 'response' => 403 )
252-
);
243+
return;
253244
}
254245

255246
wp_enqueue_style( 'wto-style', plugin_dir_url( __DIR__ ) . 'assets/css/admin.css', array(), $plugin_version );

0 commit comments

Comments
 (0)