如何使"META“字段对填入的内容进行"META:[]”?我正在使用以下代码:
register_taxonomy( 'job_listing_category', 'job_listing', [
'labels' => [
'name' => _x( 'Categories', 'Category taxonomy labels', 'my-listing' ),
'singular_name' => _x( 'Category', 'Category taxonomy labels', 'my-listing' ),
'menu_name' => _x( 'Categories', 'Category taxonomy labels', 'my-listing' ),
'search_items' => _x( 'Search Categories', 'Category taxonomy labels', 'my-listing' ),
'all_items' => _x( 'All Categories', 'Category taxonomy labels', 'my-listing' ),
'parent_item' => _x( 'Parent Category', 'Category taxonomy labels', 'my-listing' ),
'parent_item_colon' => _x( 'Parent Category:', 'Category taxonomy labels', 'my-listing' ),
'edit_item' => _x( 'Edit Category', 'Category taxonomy labels', 'my-listing' ),
'update_item' => _x( 'Update Category', 'Category taxonomy labels', 'my-listing' ),
'add_new_item' => _x( 'Add New Category', 'Category taxonomy labels', 'my-listing' ),
'new_item_name' => _x( 'New Category Name', 'Category taxonomy labels', 'my-listing' ),
],
'rewrite' => [
'slug' => $permalink_structure['category_base'],
'with_front' => false,
'hierarchical' => false,
],
'hierarchical' => true,
'update_count_callback' => '_update_post_term_count',
'show_ui' => true,
'show_tagcloud' => false,
'public' => true,
'show_in_rest' => true,
] );发布于 2019-12-11 09:28:26
您可以从json获得数组,如下所示:
$request = wp_remote_get( 'https://parquedasfeiras.online/wp-json/wp/v2/job_listing' );
if( is_wp_error( $request ) ) {
return false; // Bail early
}
$body = wp_remote_retrieve_body( $request );
$data = json_decode( $body );
if( ! empty( $data ) ) {
foreach($data as $subdata){
print_r($subdata->meta);
}
}https://wordpress.stackexchange.com/questions/354331
复制相似问题