• Resolved psn

    (@psn)


    Hi

    We use define('DISALLOW_FILE_EDIT', true); in wp-config.php for disable editing theme and plugin files in dashboard but now its seems not be working as the editor for both is available. Any idea why?

    Per

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator t-p

    (@t-p)

    Try:
    Flushing any caching plugins you might be running, as well as server and/or browser caches. Not just your browser, but any op cache or content network cache as well such as Cloudflare. If you are using SiteLock, manage your caching there.
    – deactivating ALL (yes all) plugins temporarily to see if this resolves the problem (plugin functions can interfere). If this works, re-activate them individually (one-by-one) to find the problematic plugin(s).
    – switching to the unedited default Theme (Twenty Seventeen.) for a moment using the WP dashboard to rule out any theme-specific issue (theme functions can interfere like plugins).

    • This reply was modified 8 years, 7 months ago by t-p.
    Thread Starter psn

    (@psn)

    Ok will test and see if something of what you suggest will help.

    Thread Starter psn

    (@psn)

    Hi

    We have now tested:
    Deactivated all plugins, didn’t solve issue
    Activated Twenty Seventeen, didn’t solve issue
    Empty browser/server cache, didn’t solve issue
    We don’t use any cache plugin

    so what more can we do?

    Thread Starter psn

    (@psn)

    I googled around and found an old ticket which seems be undergoing, might be some change in WP core to not allow this setting?? Look at this ticket: https://core.trac.ww.wp.xz.cn/ticket/31779

    Thread Starter psn

    (@psn)

    No its not any core changes, I checked an other site we have and there its working so it must be something else that we have done that cause this issue.

    First, that trac ticket is related to adding warnings in the Theme and Plugin Editors, to make folks more aware of the best practices for modifying (or not modifying) them.

    Second, on a fully default install, I just added define('DISALLOW_FILE_EDIT', true); to wp-config.php and I then saw the admin menu items to edit plugins and edit theme vanish, namely:

    Plugins – > Editor = /wp-admin/theme-editor.php
    Appearance -> Editor = /wp-admin/plugin-editor.php

    I went so far as to run the url’s directly and saw:
    Sorry, you are not allowed to access this page.

    So, on a default install it does in fact work as noted at:
    https://codex.ww.wp.xz.cn/Editing_wp-config.php

    Try re-installing WordPress manually. Then switch to default theme, deactivate all plugins and try again.

    Note from Editing_wp-config

    Please note: the functionality of some plugins may be affected by the use of current_user_can(‘edit_plugins’) in their code. Plugin authors should avoid checking for this capability, or at least check if this constant is set and display an appropriate error message. Be aware that if a plugin is not working this may be the cause.

    Thread Starter psn

    (@psn)

    Hi,

    Have now tested to manually re-install WP, deactivate all plugins, changed theme to Twenty Seventeen and added define(‘DISALLOW_FILE_EDIT’, true); into wp-config but still we can see the Editor in each menu and we still can reach editor for both without any warning or blocked by any text.

    So question is if its something in database that prevent these 2 editors to be hidden? We have also run wp_debug true but this don’t show anything at all so no error in PHP we assume.

    Any tip what to do next will be helpful!

    Thread Starter psn

    (@psn)

    Issue found, it was connected to credentials in db 😄

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Disallow file edit not working’ is closed to new replies.