Cách ngăn PBS hiển thị
Bạn có thể ngăn PB Sandwich hiển thị ở front-end bằng cách sử dụng bộ lọc pbs_is_editable_by_user.
Ví dụ: để ngăn PB Sandwich hiển thị trong Custom Post Type được xác định bởi slug slider, bạn có thể thêm đoạn mã này vào tệp functions.php của mình
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;
}
Để dừng PB Sandwich cho một trang/bài viết cụ thể, bạn có thể sử dụng ID bài viết để kiểm tra:
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;
}