Skip Navigation

[Resolved] Disable Toolset Button using Custom Code Setting

This support ticket is created 3 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 4 replies, has 3 voices.

Last updated by shrinivasanK 3 years, 4 months ago.

Assisted by: Jamal.

Author
Posts
#2104587
addcode.jpg

I would like to disable Fields and Access & Condition button

I found this thread https://toolset.com/forums/topic/how-to-disable-toolset-buttons-on-post-content-fields-for-non-admins/

But my question is

Instead of adding those codes in functions.php file

can I add those code in custom code tab of Toolbox Settings ?

so that custom codes are organised in one area

#2104735

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

In this case it is possible, yes.

The code in the thread you linked to uses the init hook to run.

The problem is that the code snippets are not initialised until the init hook itself, with priority 20.

So you can add code snippets so long as the code doesn't need to run until at least the init hook with priority 21.

So the key line in the linked thread code would become:

add_action( 'init', 'remove_toolset_buttons', 21 );
#2110739
conditionbutton.jpg

Thanks it works

how to remove "conditional output " button in classic editor of CPTs

#2110819

Use the following code to remove the "Conditional output" button:

add_filter( 'mce_buttons', 'remove_toggle_button', 999 );
function remove_toggle_button($buttons) {
    foreach( $buttons as $i => $button ) {
		if ( $button == "wpv_conditional_output" ) {
			unset( $buttons[$i] );
		}
	}
	return $buttons;
}

However this code will remove the button from the Visual tab bar. Once you switch to the Text tab, you will still see the button "Conditional output". To remove it from there too, use custom CSS code, using a 3rd party plugin such as Admin CSS:

#qt_content_wpv_conditional{
    display: none;
}
#2113215

My issue is resolved now. Thank you!