• I changed the content directory using Ithemes security advanced setting.

    ‘The wp-content directory is available at app-data’.

    But My problem is none of media files in new directory is showing in WordPress media library. I was able to use that images (uploads in new directory) before itheme security new update. as of now I can’t use any of image from directory or can’t upload new image to it.

    https://www.ads-software.com/plugins/better-wp-security/

Viewing 9 replies - 1 through 9 (of 9 total)
  • If,for any reason, the following lines not written by iThemes Security, then wordpress unable to find exact location of media library. Make sure the following present in wp-config.php file.

    //Do not delete these. Doing so WILL break your site.
    define( ‘WP_CONTENT_URL’, ‘https://youtdomain.com/app-data’ );
    define( ‘WP_CONTENT_DIR’, ‘/home/your-cpanel-username/public_html/wordpress-directory-name/app-data’ );

    /home/your-cpanel-username/public_html/ is document root, change this path if your server having a different path.

    Thread Starter suraj jadhav

    (@suraj-jadhav)

    @rammannaraau sir. thank you sir for your reply, I will check this asap. thanks again.

    Thread Starter suraj jadhav

    (@suraj-jadhav)

    define( ‘WP_CONTENT_DIR’, ‘/home/s3stuffs/public_html/app-data’ ); // Do not remove. Removing this line could break your site. Added by Security > Settings > Change Content Directory.
    define( ‘WP_CONTENT_URL’, ‘https://www.domainname.com/app-data’ ); // Do not remove. Removing this line could break your site. Added by Security > Settings > Change Content Directory.

    as I can see this lines of codes are already there. is this right? or I should make some changes to it? (I don’t have WordPress backend knowledge)

    No need to change those lines. Do not write your cPanel id in public forums. If possible replace cpanel id with random name before logout from wp.org

    Let met check what’s wrong with your setup at my end

    After changing wp-content directory, you need to logout and login again. If issue is still present, then check the following

    1. Under iThemes security > settings > Global Settings > Path to Log Files
    2. Under iThemes security > settings > Database Backups > Backup
    3. Location

    If you find wp-content directory instead of app-data directory in those two paths, just click on restore default location button. Logout and login again, then see if you are able to access media library.

    We have been using this feature on several websites without any issues except those mentioned above.

    Thread Starter suraj jadhav

    (@suraj-jadhav)

    no luck I done each and every step as you said. ??

    Thread Starter suraj jadhav

    (@suraj-jadhav)

    @*B.V.RammannaRaau* problem solved sir.

    solution-
    1. login to phpmyadmin
    2.In particular database select wp-option table (search for ‘wp’ according to prefix if already changed)
    3.search for upload_path option name
    4.Change the option value to new directory
    ex. /home/cpanel_id/public_html/wp-content/uploads will be /home/cpanel_id/public_html/new-directory/uploads (where new directory is user specified)

    @suraj jadhav

    As this issue seems to be solved please take a moment and mark this topic as ‘resolved’. ??

    dwinden

    @suraj jadhav
    one of the last communication from your end says

    I don’t have WordPress backend knowledge

    That’s why i didn’t recommended phpMyAdmin option.
    Also you gave some information about site as

    I was able to use that images (uploads in new directory) before itheme security new update. as of now I can’t use any of image from directory

    It means you have an existing site. iThemes Security feature for changing wp-content directory name is not recommended for existing site, but for new site installation only.

    In your last communication you mentioned that changing upload_path though phpMyAdmin resolves your issue. But actually it is a partially solution for your issue. By changing upload_path though phpMyAdmin, you can upload and link any attachment for the posts you are going to publish in future. But existing attachments still contains default wp-content instead of newly changed app-data (your custom directory name) in database.

    Since you can access with phpMyAdmin, follow the following instructions:

    • Goto wp-posts table
    • sort table by clicking post_type
    • verify all that says attachment
    • look at urls under guid, all they have still point to old or default directory wp-content

    If you have more attachments in the existing site, then you need to change all wp-content occurrences, but just changing upload_path is not sufficient enough.

    Best solutions is one of the following:

    1. First option: in phpMyAdmin, you need to change all occurrences of wp-content in all possible tables using SQL queries or manually change just like you did for upload_path
    2. Second option:
    • backup database.
    • drop all tables but not database.
    • open backup database with notepad.
    • replace all occurrences of wp-content with newly changed directory name, and save it with new name
    • then upload newly saved data to the existing database name
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘unable to use images in directory’ is closed to new replies.