Support » Fixing WordPress » can't attach images from media library

  • Hello everybody,

    I can’t attach images from the media library anymore. This happened after I added a secondary navigator menu to the funtions.php file of the theme.

    /* -------------------------------------------------------------------------------- */
    /* register menu
    /* -------------------------------------------------------------------------------- */
    register_nav_menus( array(
     'primary' => __( 'Primary Menu', 'Photogra' ),
     'secondary' => __( 'Secondary Menu', 'Photogra'),
     ) );

    I know I am able to upload and attach directly through the image uploader, but I also want to be able to attach images through the media library. Does anyone know a solutions, do I need to change something in functions.php?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I don’t see anything in your functions that would disable Media Library functionality.

    Have you tried…

    • flush any caching plugins you might be running, as well as server and/or browser caches.
    • deactivate all plugins to see if this resolves the problem. If this works, re-activate the plugins one by one until you find the problematic plugin(s). Sometimes, an apparently inactive plugin can still cause problems.
    • If you can’t get into your admin dashboard, try resetting the plugins folder by FTP or PhpMyAdmin (read this page if you need help).
    • switch to the Twenty Eleven theme to rule out any theme-specific problems.
    • If you can’t log in to change themes, you can remove the theme folders via FTP so the only one is twentyeleven. That will force your site to use it.
    • manual upgrade. When all else fails, download a fresh copy of the file of 3.5 (top right on this page) to your computer, and use that to copy up. You may need to delete the wp-admin and wp-includes folders on your server. Read the Manual Update directions first.
    • check the Master List to see if you’re experiencing a known issue:

    Thanks for the feedback. I tried the things you suggested. It is theme related and not plugin related. But like I said it only happened until I added some lines of code to the functions.php file. If I exchange it with the original everything works fine again. I forget to tell I also added something else, below is everything I added to the functions.php:

    /* -------------------------------------------------------------------------------- */
    /* register menu
    /* -------------------------------------------------------------------------------- */
    register_nav_menu( 'primary', __( 'Primary Menu', 'Photogra' ) );
    register_nav_menu( 'secondary', __( 'Secondary Menu', 'Photogra' ) );
    /*Replaces "current-menu-item" with "active"
    function current_to_active($text){
            $replace = array(
                    //List of menu item classes that should be changed to "active"
                    'current_page_item' => 'active',
                    'current_page_parent' => 'active',
                    'current_page_ancestor' => 'active',
            $text = str_replace(array_keys($replace), $replace, $text);
                    return $text;
    add_filter ('wp_nav_menu','current_to_active');

    Someone has any idea?

    You should only need opening and closing php tags at the beginning and end of the whole file, not between each function – see if that makes a difference?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘can't attach images from media library’ is closed to new replies.