[wp-trac] [WordPress Trac] #65209: Connectors: Expose isFileModDisabled flag to connector script module data.
WordPress Trac
noreply at wordpress.org
Fri May 8 16:04:33 UTC 2026
#65209: Connectors: Expose isFileModDisabled flag to connector script module data.
------------------------------+--------------------
Reporter: jorgefilipecosta | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 7.0
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: |
------------------------------+--------------------
Backports PR https://github.com/WordPress/gutenberg/pull/77521.
Makes an enhacement so the connectors screen say if the website has
disallowed file modifications.
The connectors admin screen needs to know whether file modifications are
permitted (e.g. when `DISALLOW_FILE_MODS` is set, when the filesystem is
not writable, or when the `file_mod_allowed` filter denies it) so the UI
can adapt accordingly — for example, surfacing the appropriate messaging
or disabling plugin-install affordances when those operations are not
allowed.
== Proposed change ==
Expose a new `isFileModDisabled` boolean on the connectors script module
data, derived from `wp_is_file_mod_allowed( 'install_plugins' )`:
{{{#!php
<?php
$data['isFileModDisabled'] = ! wp_is_file_mod_allowed( 'install_plugins'
);
}}}
== Testing ==
1. Load the connectors admin screen and inspect the script module data
payload — `isFileModDisabled` should be present and `false` on a
standard install.
2. Add `define( 'DISALLOW_FILE_MODS', true );` to `wp-config.php` and
reload — `isFileModDisabled` should now be `true`.
3. Confirm the value also flips when a filter denies the
`install_plugins` context, e.g.:
{{{#!php
<?php
add_filter( 'file_mod_allowed', function ( $allowed, $context ) {
return 'install_plugins' === $context ? false : $allowed;
}, 10, 2 );
}}}
== Patch ==
GitHub PR: [https://github.com/WordPress/wordpress-develop/pull/11779
--
Ticket URL: <https://core.trac.wordpress.org/ticket/65209>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list