[resolved] Sorry, that file cannot be edited, with 2.9 (18 posts)

  1. cryonics
    Posted 6 years ago #

    I have this message now once 2.9 installed when I try to edit a file:

    Sorry, that file cannot be edited

    I can change and save the file that is already in the edit box, but I can not select another one.

    And this depend upon the theme. The problem does not occurs with other even very old themes.

    What hapenned in 2.9 about validation and some themes? (This is the function validate_file_to_edit that throws the error).

  2. cryonics
    Posted 6 years ago #

    Solved once I upgraded the pagebar plugin, for some obscure reason!

  3. envt
    Posted 6 years ago #

    Still a problem. I disabled all plugins and still got the same error message.

    Maybe this will help someone fix the problem:

    This workaround actually works (but not well): http://www.serv.co.za/forum/how/3280-wordpress-sorry-file-cannot-edited.html

    I made it work with version 2.9 by putting the extra line--$file = $allowed_files[3]; -- in the theme-editor.php file in the following manner...note that by changing the 3 to another number, this brings up a different file in the editor, no longer bringing up the message about not being able to edit.

    if (empty($file)) {
    $file = $allowed_files[0];

    } else {
    $file = stripslashes($file);
    if ( 'theme' == $dir ) {
    $file = dirname(dirname($themes[$theme]['Template Dir'])) . $file ;
    } else if ( 'style' == $dir) {
    $file = dirname(dirname($themes[$theme]['Stylesheet Dir'])) . $file ;

    $file = $allowed_files[3];

    validate_file_to_edit($file, $allowed_files);

  4. freewordpressthemes4u
    Posted 6 years ago #

    validate_file_to_edit($file, $allowed_files);

    [0] => C:\www\vhosts\localhost\corp\wpthemes\www\versions\wp291\wordpress/wp-content/themes/multitasking_woman_pee137/style.css
    [1] => C:\www\vhosts\localhost\corp\wpthemes\www\versions\wp291\wordpress/wp-content/themes/multitasking_woman_pee137/style.ie6.css
    [2] => C:\www\vhosts\localhost\corp\wpthemes\www\versions\wp291\wordpress/wp-content/themes/multitasking_woman_pee137/404.php
    [3] => C:\www\vhosts\localhost\corp\wpthemes\www\versions\wp291\wordpress/wp-content/themes/multitasking_woman_pee137/archive.php
    [4] => C:\www\vhosts\localhost\corp\wpthemes\www\versions\wp291\wordpress/wp-content/themes/multitasking_woman_pee137/archives.php
    [5] => C:\www\vhosts\localhost\corp\wpthemes\www\versions\wp291\wordpress/wp-content/themes/multitasking_woman_pee137/comments.php
    [6] => C:\www\vhosts\localhost\corp\wpthemes\www\versions\wp291\wordpress/wp-content/themes/multitasking_woman_pee137/footer.php
    [7] => C:\www\vhosts\localhost\corp\wpthemes\www\versions\wp291\wordpress/wp-content/themes/multitasking_woman_pee137/functions.php
    [8] => C:\www\vhosts\localhost\corp\wpthemes\www\versions\wp291\wordpress/wp-content/themes/multitasking_woman_pee137/header.php
    [9] => C:\www\vhosts\localhost\corp\wpthemes\www\versions\wp291\wordpress/wp-content/themes/multitasking_woman_pee137/index.php
    [10] => C:\www\vhosts\localhost\corp\wpthemes\www\versions\wp291\wordpress/wp-content/themes/multitasking_woman_pee137/legacy.comments.php
    [11] => C:\www\vhosts\localhost\corp\wpthemes\www\versions\wp291\wordpress/wp-content/themes/multitasking_woman_pee137/links.php
    [12] => C:\www\vhosts\localhost\corp\wpthemes\www\versions\wp291\wordpress/wp-content/themes/multitasking_woman_pee137/page.php
    [13] => C:\www\vhosts\localhost\corp\wpthemes\www\versions\wp291\wordpress/wp-content/themes/multitasking_woman_pee137/search.php
    [14] => C:\www\vhosts\localhost\corp\wpthemes\www\versions\wp291\wordpress/wp-content/themes/multitasking_woman_pee137/searchform.php
    [15] => C:\www\vhosts\localhost\corp\wpthemes\www\versions\wp291\wordpress/wp-content/themes/multitasking_woman_pee137/sidebar1.php
    [16] => C:\www\vhosts\localhost\corp\wpthemes\www\versions\wp291\wordpress/wp-content/themes/multitasking_woman_pee137/single.php

    looks like the allowed_files is not formatted properly.

  5. unibox
    Posted 6 years ago #

    Upgrading pagebar worked for me also.

  6. cwgservices
    Posted 6 years ago #

    I found the cause of this error, which will occur in random configurations of wp. It's a variable left uninitialized.

    See more here:

  7. hydroweb
    Posted 6 years ago #

    Followed that link but exactly what am I supposed to do? Do I need to alter all 3 files?



  8. hydroweb
    Posted 6 years ago #

    Oops, third file should be misc.php

  9. geezerd
    Posted 6 years ago #

    I'm having the same problem.
    Exactly what are we supposed to do with the info
    at http://core.trac.wordpress.org/ticket/11974 ?

    Replace theme-editor.php with the one there?
    Replace plugin-editor.php with the one there?
    In misc.php, I think I can figure out which is the new and which is the old code and edit it, so I'm good with that, I think.

    That all correct?

  10. dezzzign
    Posted 6 years ago #

    I had the same problem, replaced theme-editor.php and plugin-editor.php, and edited misc.php, but it didn't work for me. Every time I wanted to edit my php files my dashboard showed me the same stylesheet.css file. Then I returned my old theme-editor.php and plugin-editor.php, but kept changed misc.php . I dont know why but it worked.
    Hope it'll work for you too and save your time...

  11. dezzzign
    Posted 6 years ago #

    Sorry for misinformation. Problem returned I uploaded again theme-editor.php and plugin-editor.php and now its resolved.

  12. dezzzign
    Posted 6 years ago #

    And again...It doesnt work.

  13. knewhams
    Posted 6 years ago #

    Because one person fixed their problem doesn't mean we all did. I had the can't edit theme problem and made the changes to the 3 programs suggested elsewhere; now the theme editor comes up with the stylesheet to edit and it won't change it. Click on a php file, it goes out, comes back and the first style sheet is still there. Changed themes, including to the WOrd press classic and default; still can't change the file to edit. If i edit the style sheet, or make a change and update, i get the message: File edited successfully and it was but i can't get another file into the theme editor. I had the problems wotj 2.9 and them i updated to 2.9.2 and problem continues

  14. esmi
    Forum Moderator
    Posted 6 years ago #

    @knewhams: Stop posting in resolved topics. Post a new topic!

  15. craig0927
    Posted 6 years ago #

    If you are experiencing this issue (can't edit themes or plugins) and the above advice DID NOT help you...I just discovered that deactivating the Ultimate SEO plugin cleared it right up for me.

  16. John
    Posted 6 years ago #

    @craig0927: Upgrade SEO Ultimate to version 1.7.3 or later to fix the problem.

  17. geezerd
    Posted 6 years ago #

    Well, I finally got my friends FTP info so I could do it, and now I have KNEWHAMS problem.
    I go to edit, click on index.php or any of the files, and it doesn't go to it, it just stays on styles.css!

  18. sh4d0w_7
    Posted 6 years ago #

    Sorry for bad english.

    After update from 2.7.1 to 2.9.2 have problem like you all.
    I try pached files from there:
    it was bad thing, editor show only styles.css.

    What i did, its just workaround.

    Downloaded again wordpress 2.9.2, grab theme-editor.php, plugin-editor.php and misc.php
    edited "theme-editor.php" at line ~173 and ~191
    this line part of generating theme files list and adding bad link to each. So i add string with part of url was missing.

    <li><a href="theme-editor.php?file=<?php echo "/xxx/xxx/xxx/wp-content".$template_file; ?>&theme=<?php echo urlencode($theme) ?>&dir=theme"><?php echo $filedesc ?></a></li>

    for finding what URL part you missing, just use "Update" button in editor, then look at adress bar and diff with theme file link in sidebar.

    for now its good, but its just stupid workaound,
    if i get some time im will search solution of problem.

Topic Closed

This topic has been closed to new replies.

About this Topic