| @@ -5,8 +5,12 @@ | ||
| 5 | 5 | * |
| 6 | 6 | * @package automattic/jetpack |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 10 | + exit( 0 ); | |
| 11 | +} | |
| 12 | + | |
| 9 | 13 | // Set up Sharing in wp-admin. |
| 10 | 14 | require_once plugin_dir_path( __FILE__ ) . 'sharing.php'; |
| 11 | 15 | |
| 12 | 16 | /** |
| @@ -113,9 +117,10 @@ | ||
| 113 | 117 | $post_type_object = get_post_type_object( sanitize_key( $_POST['post_type'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Core takes care of the validation. |
| 114 | 118 | |
| 115 | 119 | // Record sharing disable. |
| 116 | 120 | if ( |
| 117 | - $post_type_object->public | |
| 121 | + $post_type_object instanceof \WP_Post_Type | |
| 122 | + && $post_type_object->public | |
| 118 | 123 | && current_user_can( 'edit_post', $post_id ) |
| 119 | 124 | && isset( $_POST['sharing_status_hidden'] ) // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Core takes care of the validation. |
| 120 | 125 | ) { |
| 121 | 126 | if ( ! isset( $_POST['enable_post_sharing'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Core takes care of the validation. |