• Hi,

    I just added a custom field and an extra product tab for woocommerce, and I need to enable shortcodes in that new custom field.

    Below is my code:

    add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab_whatsincluded' );
    function woo_new_product_tab_whatsincluded( $tabs ) {
    	$tabs['report_whatsincluded_tab'] = array(
    		'title' 	=> __( "What's Included", 'woocommerce' ),
    		'priority' 	=> 50,
    		'callback' 	=> 'woo_new_product_tab_whatsincluded_content'
    	);
    	return $tabs;
    }
    function woo_new_product_tab_whatsincluded_content() {
        global $wp_query;
        $post_id = $wp_query->post->ID;
    	echo wp_specialchars( get_post_meta( $post_id, "What's Included", true ), 1 );
    }

    Any idea?

Viewing 2 replies - 1 through 2 (of 2 total)
  • $post_id = $wp_query->post->ID; I think this one made an error. Just remove the post $post_id = $wp_query->ID;

    If not work. Make sure you see how to work with wp_query

    Thread Starter ikramy

    (@ikramy)

    Hi mrjhon01,

    I don’t think there is an issue with the post ID, the date gets pulled without issues.

    All I need to do is to execute shortcodes for custom fields.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Enable shortcode for custom field’ is closed to new replies.