PBS가 표시되지 않도록 하는 방법

PBS가 표시되지 않도록 하는 방법

pbs_is_editable_by_user 필터를 사용하여 PB Sandwich가 프론트엔드에 표시되지 않도록 할 수 있습니다.

예를 들어 슬러그가 slider인 사용자 정의 포스트 타입(Custom Post Type)에서 PB Sandwich가 표시되지 않도록 하려면 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;
}

특정 페이지/글에서 PB Sandwich를 중지하려면 포스트 ID를 사용하여 확인할 수 있습니다:

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;
}