How to Stop PBS From Showing Up

How to Stop PBS From Showing Up

How to Stop PBS From Showing Up

You can prevent PB Sandwich from showing up in the front-end using the pbs_is_editable_by_user filter.

For example, to stop PB Sandwich from showing up in a Custom Post Type identified by the slug slider, you can add this piece of code in your functions.php

add_filter( 'pbs_is_editable_by_user', 'stop_pbs_in_sliders' );

function stop_pbs_in_sliders( $editable ) {
	if ( is_singular( 'slider' ) ) {
		return false;
	}
	return $editable;
}

To stop PB Sandwich for a specific page/post, you can use the post ID to check:

add_filter( 'pbs_is_editable_by_user', 'stop_pbs_for_123' );

function stop_pbs_for_123( $editable ) {
	global $post;
	if ( is_singular() && ! empty( $post ) ) {
		if ( '123' === $post->ID ) {
			return false;
		}
	}
	return $editable;
}

Still need help? Contact Us

Share this page!

Facebook
Twitter
LinkedIn
WhatsApp
Telegram
Skype

The Author

Contact Us