Bí A Ṣe Lè Dá PBS Dúró Láti Má Ṣe Hàn

Bí a Ṣe Lè Dá PBS Dúró Láti Má Ṣe Farahàn

O lè dènà PB Sandwich láti má ṣe farahàn ní iwájú (front-end) nípa lílo àlẹ̀mọ́ pbs_is_editable_by_user.

Fún àpẹẹrẹ, láti dá PB Sandwich dúró láti má ṣe farahàn nínú Custom Post Type tí a mọ̀ nípasẹ̀ slug slider, o lè fi àkójọpọ̀ kóòdù yìí kún functions.php rẹ

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

Láti dá PB Sandwich dúró fún ojú-ewé/àkọsílẹ̀ pàtó kan, o lè lo ID àkọsílẹ̀ náà láti ṣàyẹ̀wò:

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