PluginProbe
Elementor Website Builder – more than just a page builder / 3.26.2
Elementor Website Builder – more than just a page builder v3.26.2
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
← All changes | modules/site-navigation/data/endpoints/add-new-post.php +3 -6 4.3.0-beta23.26.2 View file →
@@ -40,15 +40,13 @@
40 40 public function create_items( $request ) {
41 41 $post_type = $request->get_param( 'post_type' );
42 42
43 43 if ( ! $this->validate_post_type( $post_type ) ) {
44 - $sanitized_post_type = esc_html( str_replace( '%', '%%', $post_type ) );
45 - return new \WP_Error( 400, sprintf( 'Post type %s does not exist.', $sanitized_post_type ), [ 'status' => 400 ] );
44 + return new \WP_Error( 400, sprintf( 'Post type %s does not exist.', $post_type ), [ 'status' => 400 ] );
46 45 }
47 46
48 47 if ( ! User::is_current_user_can_edit_post_type( $post_type ) ) {
49 - $sanitized_post_type = esc_html( str_replace( '%', '%%', $post_type ) );
50 - return new \WP_Error( 401, sprintf( 'User dont have capability to create page of type - %s.', $sanitized_post_type ), [ 'status' => 401 ] );
48 + return new \WP_Error( 401, sprintf( 'User dont have capability to create page of type - %s.', $post_type ), [ 'status' => 401 ] );
51 49 }
52 50
53 51 // Temporary solution for the fact that documents creation not using the actual registered post types.
54 52 $post_type = $this->map_post_type( $post_type );
@@ -55,10 +53,9 @@
55 53
56 54 $document = Plugin::$instance->documents->create( $post_type );
57 55
58 56 if ( is_wp_error( $document ) ) {
59 - $sanitized_post_type = esc_html( str_replace( '%', '%%', $post_type ) );
60 - return new \WP_Error( 500, sprintf( 'Error while creating %s.', $sanitized_post_type ) );
57 + return new \WP_Error( 500, sprintf( 'Error while creating %s.', $post_type ) );
61 58 }
62 59
63 60 return [
64 61 'id' => $document->get_main_id(),