WordPress.org

Ready to get started?Download WordPress

Forums

can't attach images from media library (4 posts)

  1. Phartog
    Member
    Posted 1 year ago #

    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.

    <?php
    /* -------------------------------------------------------------------------------- */
    /* 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?

  2. Jess
    Member
    Posted 1 year ago #

    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 latest.zip 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: http://wordpress.org/support/topic/troubleshooting-wordpress-35-master-list
  3. Phartog
    Member
    Posted 1 year ago #

    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:

    <?php
    /* -------------------------------------------------------------------------------- */
    /* register menu
    /* -------------------------------------------------------------------------------- */
    register_nav_menu( 'primary', __( 'Primary Menu', 'Photogra' ) );
    register_nav_menu( 'secondary', __( 'Secondary Menu', 'Photogra' ) );
    ?>
    
    <?php
    /*
    -----------------------------------------------------------------------*/
    /*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?

  4. Jess
    Member
    Posted 1 year ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic