diff options
author | Daniel Weipert <code@drogueronin.de> | 2021-03-18 15:54:11 +0100 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2021-03-18 15:54:11 +0100 |
commit | 143df0bab5534c3423f60a0062b580ffe26360e7 (patch) | |
tree | d276332d14a655e2eaf0af7535d40bfdca7e1511 /src/class-draggable-post-order.php | |
parent | 26a80b7c2d4941abbfd51fd39459ac22612e18d7 (diff) |
Fixes custom post type support
Diffstat (limited to 'src/class-draggable-post-order.php')
-rw-r--r-- | src/class-draggable-post-order.php | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/class-draggable-post-order.php b/src/class-draggable-post-order.php index ee9156c..5645092 100644 --- a/src/class-draggable-post-order.php +++ b/src/class-draggable-post-order.php @@ -33,7 +33,7 @@ class Draggable_Post_Order { * * @var string */ - public static string $nonce = 'draggable-post-order'; + public static string $nonce = '_draggable-post-order'; /** * Initialize. @@ -67,16 +67,23 @@ class Draggable_Post_Order { } /** - * Whether the given post type is allowed to be ordered. + * Whether the given post type(s) are allowed to be ordered. * - * @param string $post_type The post type to check against. + * @param string $post_types The post type(s) to check against. * * @return bool */ - public static function supports( $post_type = null ) { - $post_type ??= get_current_screen()->post_type ?? ''; + public static function supports( $post_types = null ) { + $post_types ??= get_current_screen()->post_type ?? ''; + $post_types = (array) $post_types; - return post_type_supports( $post_type, self::$post_type_feature ); + foreach ( $post_types as $post_type ) { + if ( ! post_type_supports( $post_type, self::$post_type_feature ) ) { + return false; + } + } + + return true; } /** |