adding custom taxonomies category and custom fields to json rest api

im working with json rest api v2 and have a problem with my custom post type:
avada_portfolio and failed to get categories and custom fields.
but i can get tags…
my function code for category is:

add_action( ‘init’, ‘avada_portfolio_category’, 25 );

function avada_portfolio_category() {
global $wp_taxonomies;

$taxonomy_name = ‘portfolio_category’;

if ( isset( $wp_taxonomies[ $taxonomy_name ] ) ) {
$wp_taxonomies[ $taxonomy_name ]->show_in_rest = true;
$wp_taxonomies[ $taxonomy_name ]->rest_base = $taxonomy_name;
$wp_taxonomies[ $taxonomy_name ]->rest_controller_class = ‘WP_REST_Terms_Controller’;
}}

Second
i cant see my custom fields for custom post type

this is my json url:
https://mtdgroup.co/wp-json/wp/v2/avada_portfolio

Read more here:: adding custom taxonomies category and custom fields to json rest api

Leave a Reply

Your email address will not be published. Required fields are marked *