WordPress.org

Ready to get started?Download WordPress

Forums

Theme editing not allowed (4 posts)

  1. RoodPetje
    Member
    Posted 3 years ago #

    I had a year ago problems with updating to a newer version of WordPress (from 2.8.6 to 3.0.1) on a test installation. Whatever I tried (disabling plugins, standard theme, checking database) I kept on getting the error

    Sorry, can’t edit files with “..” in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.

    Since my real blog is still running 2.8.6 I want to update it. So I gave it a new try with an update. Unfortunately with no success, the error just came back. I also couldn't login due to another error:

    Warning: main(./wp-load.php) [function.main]: failed to open stream: No such file or directory in ./admin.php on line 30

    I don't know if there is a relationship between the two errors, but this is how I solved it.
    in admin.php (included in the directory wp-admin) I added a . before /wp-load.php

    That solved the login problem

    In file.php (included in wp-admin/include) I commented out the die statement in the validate_file function so it looks like this:

    function validate_file_to_edit( $file, $allowed_files = '' ) {
    $code = validate_file( $file, $allowed_files );

    if (!$code )
    return $file;

    switch ( $code ) {
    //case 1 :
    // wp_die( __('Sorry, can’t edit files with “..” in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.' ));

    //case 2 :
    // wp_die( __('Sorry, can’t call files with their real path.' ));

    case 3 :
    wp_die( __('Sorry, that file cannot be edited.' ));
    }
    }

    I think this is a hard way, but at least I am able to work on the themes again with a newer WP version.

    If anyone has a better solution (again, I have tried to disable the plugins etc), please let me know.

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    Don't edit WordPress core files!

  3. RoodPetje
    Member
    Posted 3 years ago #

    I know that it's better not to do so, but is the only solution that works.
    I have even reinstalled WP from scratch, the only file I kept was the wp-config.php, since that contains the database information. Still the same problem.
    And no theme other than the standard theme installed, and nog plug-in at all. Still giving me the same errors.
    Wordpress is really giving me severe headaches.

  4. JaneGarratt
    Member
    Posted 2 years ago #

    I am having the same problem. When I go to the theme editor I get this message

    Sorry, can’t edit files with “..” in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.

    I have no idea what to do about it. I don't want to do what the previous writer did. Does anyone have suggestions/a solution?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.