@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.cjs
CHANGED
|
@@ -321,25 +321,28 @@ This will ensure your code works reliably regardless of the current working dire
|
|
|
321
321
|
add_action( 'wp_insert_post_data', function( $data ) {
|
|
322
322
|
return wp_slash($data);
|
|
323
323
|
});
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
324
|
+
|
|
325
|
+
// Ensure that Site Editor templates are associated with the correct taxonomy.
|
|
326
|
+
function wp_playground_import_post_terms_handler( $terms, $post_id ) {
|
|
327
|
+
foreach ( $terms as $term ) {
|
|
328
|
+
if ( 'wp_theme' !== $term['taxonomy'] ) continue;
|
|
329
|
+
$post_term = get_term_by('slug', $term['slug'], $term['taxonomy'] );
|
|
330
|
+
if ( ! $post_term ) {
|
|
331
|
+
$post_term = wp_insert_term(
|
|
332
|
+
$term['slug'],
|
|
333
|
+
$term['taxonomy']
|
|
334
|
+
);
|
|
335
|
+
$term_id = $post_term['term_id'];
|
|
336
|
+
} else {
|
|
337
|
+
$term_id = $post_term->term_id;
|
|
338
|
+
}
|
|
339
|
+
wp_set_object_terms( $post_id, $term_id, $term['taxonomy']) ;
|
|
340
|
+
}
|
|
341
|
+
return $terms;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
add_filter( 'wp_import_post_terms', 'wp_playground_import_post_terms_handler', 10, 2 );
|
|
345
|
+
|
|
343
346
|
$result = $importer->import( '/tmp/import.wxr' );
|
|
344
347
|
`})}const wr=async(r,{themeSlug:t=""},n)=>{var u;(u=n==null?void 0:n.tracker)==null||u.setCaption("Importing theme starter content");const d=await r.documentRoot;await r.run({code:`<?php
|
|
345
348
|
|