Can't get empty(), isset(), or null to work

by Sam Waters   Last Updated April 04, 2018 22:08 PM - source

I can't get the IF statement to work for this specific variable. Please help! I have tried:

$compatibles = !null
! isset($compatibles)
$compatibles = 0
! empty($compatibles)

$compatibles = get_post_meta( get_the_ID(), 'compatible_products_ids', true );
$other_compatible_products_field_value = get_post_meta( get_the_ID(), 'other_compatible_products', true );

if (! empty ($compatibles) ){
    // Adds the new tab
    $tabs['compatible_products'] = array(
        'title'     => __( 'Compatible Products', 'woocommerce' ),
        'priority'  => 50,
        'callback'  => 'woo_compatible_products_tab_content'
    );
    return $tabs;
}

}



Related Questions


show custom field content in jquery tabs

Updated April 05, 2018 19:08 PM

Creating tabs on shopping page

Updated June 15, 2016 08:03 AM

Woocommerce product tabs in order display error

Updated March 15, 2019 15:08 PM