WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am generating the following notice in my options.php when testing my theme in wp_debug mode.

I can see where the problem is but do not know how to fix this issue?

It seems the non object is being called from the taxonomy array in options.php as the array cannot find the term_id because a post and or category has not been created in the custom post type. When I create a post and assign a category to it, the notice disappears.

// Pull all the custom taxonomies into an array
$options_password_taxonomies = array();
$taxonomies_password_terms_obj = get_terms('password_gallery_category');
foreach ( $taxonomies_password_terms_obj as $taxonomy) {
    $options_password_taxonomies[$taxonomy->term_id] = $taxonomy->name;

// Select a Category for your Client Area
$options[] = array(
    'name' => __('Password Protected Galleries', 'shutter'),
    'desc' => __('Choose a category for password protected client galleries.',     'shutter'),
    'id' => 'client_area',
    'type' => 'select',
    'options' => $options_password_taxonomies);
share|improve this question
up vote 0 down vote accepted

You can use isset() or property_exists() to check if the property exists.

foreach ( $taxonomies_password_terms_obj as $taxonomy) {
    if( isset( $taxonomy->term_id ) ){
        $options_password_taxonomies[$taxonomy->term_id] = $taxonomy->name;
share|improve this answer
Thanks for this. It fixes the issue but generates a new notice. Should i post this as a new question? Notice: Undefined index: homepage_feature in /inc/options-framework.php on line 313 – Dean McCann Feb 27 '13 at 10:38
Yes you should post as a new question. Before, go to that line and use another isset() before using that array variable. It should be fixed. – RRikesh Feb 27 '13 at 10:40
Thanks. I can see there is an isset() already in options-framework.php - but this doesn't seem to make a difference. if ( ! isset( $option['id'] ) ) { continue; } – Dean McCann Feb 27 '13 at 10:47
ok, I entered a new isset() for term_id and this seems to remove the errors. thank you for introducing me to the magic of isset() :) – Dean McCann Feb 27 '13 at 10:50
ok this actually didnt resolve my second issue, so will repost another question. – Dean McCann Feb 27 '13 at 12:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.