@wp-playground/blueprints 2.0.18 → 2.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +22 -19
- package/index.cjs.map +1 -1
- package/index.js +22 -19
- package/index.js.map +1 -1
- package/package.json +13 -13
package/index.js
CHANGED
|
@@ -942,25 +942,28 @@ async function Rt(r, t, n) {
|
|
|
942
942
|
add_action( 'wp_insert_post_data', function( $data ) {
|
|
943
943
|
return wp_slash($data);
|
|
944
944
|
});
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
945
|
+
|
|
946
|
+
// Ensure that Site Editor templates are associated with the correct taxonomy.
|
|
947
|
+
function wp_playground_import_post_terms_handler( $terms, $post_id ) {
|
|
948
|
+
foreach ( $terms as $term ) {
|
|
949
|
+
if ( 'wp_theme' !== $term['taxonomy'] ) continue;
|
|
950
|
+
$post_term = get_term_by('slug', $term['slug'], $term['taxonomy'] );
|
|
951
|
+
if ( ! $post_term ) {
|
|
952
|
+
$post_term = wp_insert_term(
|
|
953
|
+
$term['slug'],
|
|
954
|
+
$term['taxonomy']
|
|
955
|
+
);
|
|
956
|
+
$term_id = $post_term['term_id'];
|
|
957
|
+
} else {
|
|
958
|
+
$term_id = $post_term->term_id;
|
|
959
|
+
}
|
|
960
|
+
wp_set_object_terms( $post_id, $term_id, $term['taxonomy']) ;
|
|
961
|
+
}
|
|
962
|
+
return $terms;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
add_filter( 'wp_import_post_terms', 'wp_playground_import_post_terms_handler', 10, 2 );
|
|
966
|
+
|
|
964
967
|
$result = $importer->import( '/tmp/import.wxr' );
|
|
965
968
|
`
|
|
966
969
|
});
|