jchristopher / attachments

[WordPress Plugin] Attachments allows you to simply append any number of items from your WordPress Media Library to Posts, Pages, and Custom Post Types
wordpress.org/extend/plugins/attachments/
GNU General Public License v2.0
241 stars 78 forks source link

Disable Settings Screen - documentation mix up #162

Closed valivvvv closed 6 years ago

valivvvv commented 8 years ago

Check up your documentation here: https://github.com/jchristopher/attachments/blob/master/docs/usage.md#disable-settings-screen

add_filter( 'attachments_settings_screen', '__return_false' ); // disable the Settings screen

This should be added to functions.php, not wp-config.php, as currently stated.

Great plugin, cheers!

orionrush commented 8 years ago

Of course that means that all someone has to do to enable the settings is change the theme . . . .

tcoukoulis commented 7 years ago

I ran into this issue, too.

image

Resulted in:

Fatal error: Call to undefined function add_filter()

When placing the code snippet from the documentation inside my theme's functions.php file everything worked as described.

While I understand the ramifications of coupling this setting to my theme, as @orionrush mentioned, the documentation here is resulting in fatal errors.

tcoukoulis commented 7 years ago

Upon further investigation, it appears the correct documentation should instruct the developer to add,

define( 'ATTACHMENTS_SETTINGS_SCREEN', false );

before

require_once(ABSPATH . 'wp-settings.php');

inside wp_config.php, which makes sense since the documentation asks the developer to use the add_filter method which isn't defined until WordPress loads the plugin.php file inside wp-settings.php.

I tested this between multiple themes and it appears to resolve the issue.

jameswlane commented 7 years ago

This issue can be closed.