How do to programmatically disable page settings and the generic editor

As you guys know by now, I am new to sage & wp, with an ok background in laravel.

I want hide the page settings and generic editor from view.

In the app> admin.php I thought for sure the following would accomplish that, but, as you can see by the previous screen shot, it did not work.

    add_action( 'remove_page_editor', function () {
    function disable_mission_page_editor(  ) {
        if ( is_singular( 'mission' ) ) {
            remove_post_type_support('page', 'editor');
        } else {
            return true;
} );

In the template page, I have tried to run the following function to dump the screen object, so that I may see what is ‘under the hood,’ so to say, but nothing.

function see_what_is_on_d_screen() {
$currentScreen = get_current_screen();

Basically what I would like to happen, is that, an editor logins into wp-admin, selects the mission page to edit and proceeds to not view the page settings or the generic editor, but to only see the ACF elements created for that specific template.

As usual, thanks in advance

So users of role ‘editor’ should only be able to edit specific ACF fields of a specific? page, right?

Yes, that is correct, but for now, I just want to see it work for everyone, including admins

This has nothing to do with Sage.

When you are creating field groups in ACFs GUI, there is a setting for hiding the editor on the screens where the field group is used. If you are using some kind of wrapper library for ACF, you should have the same option there.

If you rather do it yourself using code (which I recommend), there is an example in the second post here:

With regards to your code: AFAIK there is no action named remove_page_editor so your function is never executed. Read more about hooks (filters and actions) here:

Even if your function had been executed, you have a function in the function so my guess is that the inner function will never be executed even if you would have had have a correct hook name. Removing the line function disable_mission_page_editor( ) { and the matching } would fix that.


I added the following to the functions.php, but it did not work:

add_action( ‘init’, function() {
remove_post_type_support( ‘post’, ‘editor’ );
remove_post_type_support( ‘page’, ‘editor’ );
}, 99);

Also, I was trying to do this within the admin.php or, which made me think that this is a Sage question.

Yes, I have tried to uncheck the boxes within the ACF “Hide on screen” section, but it did not work either.

I am still seeing the page settings and generic editor. I have yet to implement for only “editors” - I would like to see what it looks like if I ‘admin’ do not see them either.

This topic was automatically closed after 42 days. New replies are no longer allowed.