Code Duplication    Length = 5-5 lines in 5 locations

plugin.php 5 locations

@@ 110-114 (lines=5) @@
107
		$wp_post_types['post']->rest_controller_class = 'WP_REST_Posts_Controller';
108
	}
109
110
	if ( isset( $wp_post_types['page'] ) ) {
111
		$wp_post_types['page']->show_in_rest = true;
112
		$wp_post_types['page']->rest_base = 'pages';
113
		$wp_post_types['page']->rest_controller_class = 'WP_REST_Posts_Controller';
114
	}
115
116
	if ( isset( $wp_post_types['attachment'] ) ) {
117
		$wp_post_types['attachment']->show_in_rest = true;
@@ 116-120 (lines=5) @@
113
		$wp_post_types['page']->rest_controller_class = 'WP_REST_Posts_Controller';
114
	}
115
116
	if ( isset( $wp_post_types['attachment'] ) ) {
117
		$wp_post_types['attachment']->show_in_rest = true;
118
		$wp_post_types['attachment']->rest_base = 'media';
119
		$wp_post_types['attachment']->rest_controller_class = 'WP_REST_Attachments_Controller';
120
	}
121
}
122
123
/**
@@ 135-139 (lines=5) @@
132
function _add_extra_api_taxonomy_arguments() {
133
	global $wp_taxonomies;
134
135
	if ( isset( $wp_taxonomies['category'] ) ) {
136
		$wp_taxonomies['category']->show_in_rest = true;
137
		$wp_taxonomies['category']->rest_base = 'categories';
138
		$wp_taxonomies['category']->rest_controller_class = 'WP_REST_Terms_Controller';
139
	}
140
141
	if ( isset( $wp_taxonomies['post_tag'] ) ) {
142
		$wp_taxonomies['post_tag']->show_in_rest = true;
@@ 141-145 (lines=5) @@
138
		$wp_taxonomies['category']->rest_controller_class = 'WP_REST_Terms_Controller';
139
	}
140
141
	if ( isset( $wp_taxonomies['post_tag'] ) ) {
142
		$wp_taxonomies['post_tag']->show_in_rest = true;
143
		$wp_taxonomies['post_tag']->rest_base = 'tags';
144
		$wp_taxonomies['post_tag']->rest_controller_class = 'WP_REST_Terms_Controller';
145
	}
146
}
147
148
if ( ! function_exists( 'create_initial_rest_routes' ) ) {
@@ 104-108 (lines=5) @@
101
function _add_extra_api_post_type_arguments() {
102
	global $wp_post_types;
103
104
	if ( isset( $wp_post_types['post'] ) ) {
105
		$wp_post_types['post']->show_in_rest = true;
106
		$wp_post_types['post']->rest_base = 'posts';
107
		$wp_post_types['post']->rest_controller_class = 'WP_REST_Posts_Controller';
108
	}
109
110
	if ( isset( $wp_post_types['page'] ) ) {
111
		$wp_post_types['page']->show_in_rest = true;