Skip to content

Commit a95788d

Browse files
supertassuKrinkle
authored andcommitted
jquery-fiters: Allow setting page template via xmlrpc api
1 parent 098eaa3 commit a95788d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

mu-plugins/jquery-filters.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,15 @@ function strip_https($url) {
131131
return str_replace( '//' . JQUERY_LIVE_SITE, '//' . JQUERY_STAGING_PREFIX . JQUERY_LIVE_SITE, $value );
132132
} );
133133
}
134+
135+
add_filter( 'xmlrpc_wp_insert_post_data', function ( $post_data, $content_struct ) {
136+
if ( $post_data['post_type'] !== 'page' ) {
137+
return $post_data;
138+
}
139+
140+
if ( isset( $content_struct['page_template'] ) ) {
141+
$post_data['page_template'] = $content_struct['page_template'];
142+
}
143+
144+
return $post_data;
145+
}, /* priority */ 10, /* accepted args */ 2 );

0 commit comments

Comments
 (0)