I took over a website from a previous developer that built most of the site. Because the theme was a custom one, he chose to do it using Toolbox. The site has been standing for just over a year, and was given to me so we can finish it.

I have an issue where I can't upload an image to a post using Advanced Custom Fields and this theme. I've determined that it's not ACF, as I've changed the theme to the default Twenty Fourteen theme that you get with Wordpress, and then image uploading works fine to that post.

After some research, I realised that the theme did not have theme support for thumbnails, so I added it by placing add_theme_support('post-thumbnails'); to my toolbox_setup method in my functions.php file. Currently that method looks like this:

function toolbox_setup() {
     * Make theme available for translation
     * Translations can be filed in the /languages/ directory
     * If you're building a theme based on toolbox, use a find and replace
     * to change 'toolbox' to the name of your theme in all the template files
    load_theme_textdomain( 'toolbox', get_template_directory() . '/languages' );

    $locale = get_locale();
    $locale_file = get_template_directory() . "/languages/$locale.php";
    if ( is_readable( $locale_file ) )
        require_once( $locale_file );

     * Add default posts and comments RSS feed links to head
    add_theme_support( 'automatic-feed-links' );

     * This theme uses wp_nav_menu() in one location.
    register_nav_menus( array(
        'primary' => __( 'Primary Menu', 'toolbox' ),
    ) );

     * Add support for the Aside and Gallery Post Formats
    add_theme_support( 'post-formats', array( 'aside', 'image', 'gallery' ) );

    // Enable support for Post Thumbnails, and declare two sizes.
    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 672, 372, true );
    add_image_size( 'toolbox-full-width', 1038, 576, true );

As I am pretty new to WordPress, I have no idea if simply doing this will solve the issue. Do I need to reload the theme? Do I have to add this somewhere else? How do I fix this issue?


I turned on debugging and this is the errors I get. This is only when I open the media uploader. I've noticed that it does actually upload the files, it just doesn't show / load them.

[06-Oct-2014 06:55:41 UTC] PHP Notice:  Trying to get property of non-object in /Users/me/Server/intune/wp-content/themes/toolbox/functions.php on line 303
[06-Oct-2014 06:55:41 UTC] PHP Notice:  Trying to get property of non-object in /Users/me/Server/intune/wp-content/themes/toolbox/functions.php on line 305
[06-Oct-2014 06:55:41 UTC] PHP Notice:  Trying to get property of non-object in /Users/me/Server/intune/wp-content/themes/toolbox/functions.php on line 303
[06-Oct-2014 06:55:41 UTC] PHP Notice:  Trying to get property of non-object in /Users/me/Server/intune/wp-content/themes/toolbox/functions.php on line 305

This are the corresponding lines in the code:

 * Filter in a link to a content ID attribute for the next/previous image links on image attachment pages
function toolbox_enhanced_image_navigation( $url ) { //300
    global $post, $wp_rewrite; //301

    $id = (int) $post->ID; //303
    $object = get_post( $id ); //304
    if ( wp_attachment_is_image( $post->ID ) && ( $wp_rewrite->using_permalinks() && ( $object->post_parent > 0 ) && ( $object->post_parent != $id ) ) ) //305
        $url = $url . '#main'; //306

    return $url; //308
add_filter( 'attachment_link', 'toolbox_enhanced_image_navigation' ); //310
  • but re-reading this... Toolbox I've never used, but I think you should be able to move the add_theme set_post and the rest to outside of the toolbox_setup function
    – vimes1984
    Oct 5, 2014 at 20:30
  • Adding thumbnail support won't fix your problem with image uploading. You need to determine what is in this custom theme that is causing the problem, and fix it or remove it.
    – Otto
    Oct 5, 2014 at 21:45
  • can you upload images as part of the content? Oct 5, 2014 at 22:08
  • @Otto, any suggestions on how I could do this? I've updated my answer with some errors I received, perhaps that helps.
    – Bird87 ZA
    Oct 6, 2014 at 6:54
  • Does image uploads work if you remove the function that is returning those errors Oct 6, 2014 at 7:24

2 Answers 2


You shouldn't have to reload anything you will need to hook this fucntion into a hook so it's actually run something like this should do it:

do_action( 'init', 'toolbox_setup' );


  • 2
    I think is add_action( 'init', 'toolbox_setup' ); Oct 5, 2014 at 23:23
  • Doesn't work. Right after the function I have add_action( 'after_setup_theme', 'toolbox_setup' );. I've added your suggestion, however still no luck.
    – Bird87 ZA
    Oct 6, 2014 at 5:48

I fixed it by just removing the function that threw the error. I have not seen any implications yet. Image upload is working perfectly now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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