pbs_save_style
A filter to modify the CSS styles being saved for a post. This is called when a save was initiated from the PBS editor.
Parameters
$style
String. The CSS styles sent for saving.
$post_id
Int. The post id which we are saving.
A filter to modify the CSS styles being saved for a post. This is called when a save was initiated from the PBS editor.
$style
String. The CSS styles sent for saving.
$post_id
Int. The post id which we are saving.
PBS adds a wrapper to identify the content area of a post. This is called after the wrapper was placed.
$content
String. The post content with the wrapper applied.
PBS sends usage stats for opted-in users every time they save in PBS’ editor. This filter can be used to stop sending data.
$true
Boolean. This is always true.
Adds Javascript properties to the pbsFrontendParams object in the front-end. The pbsFrontendParams object is available in the front-end regardless when the user is logged in and editing.
$params
Array. An array of keys and values which will become available in the window-level Javascript variable pbsFrontendParams
Make a variable accessible in the front-end
add_filter( 'pbs_localize_frontend_scripts, 'add_my_property' );
function add_my_property( $params ) {
// This will be available in Javascript under pbsFrontendParams.myProperty
$params['myProperty'] = 'My Property';
return $params;
}
Adds Javascript properties to the pbsParams object in the front-end. The pbsParams object is available in the front-end when the user is logged in and is capable of editing the page.
This variable also carries a lot of the properties used by PBS during editing, such as nonces, a list of all loaded shortcodes, and translation strings.
$params
Array. An array of keys and values which will become available in the window-level Javascript variable pbsParams
Add a non-detected shortcode into the editor
add_filter( 'pbs_frontend_scripts, 'add_my_shortcode' );
function add_my_shortcode( $params ) {
$params['shortcodes'][] = 'my_shortcode';
return $params;
}
A filter to modify the post data to be saved. This is called when a save was initiated from the PBS editor.
$post_data
Array. The final post data to be saved, this is passed directly to wp_update_post() afterwards.
$_POST
Array. The raw post data sent from the editor for saving. This has already been nonce verified.
$post_id
Int. The post id which we are saving.
add_filter( 'pbs_save_content_data', 'save_always_as_draft', 10, 3 );
function save_always_as_draft( $post_data, $_post, $post_id ) {
// For some reason, we always want the post to be a draft.
$post_data['post_status'] = 'draft';
return $post_data;
}
A filter to modify the post content to be saved. This is called when a save was initiated from the PBS editor.
$content
String. The final post content to be saved.
$post_id
Int. The post id which we are saving.
PBS >= 4.3
Override the decision whether or not to load PBS in the front-end and allow the user to use PBS to edit the post.
$is_editable
Boolean. True if the post should be editable with PBS. False otherwise
Disallow portfolio post_types to be editable with PBS
add_filter( 'pbs_is_editable_by_user', 'disallow_portfolios' );
function disallow_portfolios( $is_editable ) {
global $post;
if ( $post ) {
if ( 'portfolio' === get_post_type( $post ) ) {
return false;
}
}
return $is_editable;
}
PBS >= 4.3
PBS adds a wrapper to identify the content area of a post. This is called before the wrapper is placed.
$content
String. The post content with the wrapper applied.
A list of shortcode tags to hide in PBS’s shortcode picker. Use this if you have shortcodes that show up in the picker popup which you have already deprecated or just want to hide from users.
$shortcodes
Array. An array of shortcode tags.
Hide the shortcode from the picker.
add_filter( 'pbs_shortcodes_to_hide_in_picker, 'hide_embed_shortcode' );
function hide_embed_shortcode( $shortcodes ) {
$shortcodes[] = 'embed';
return $shortcodes;
}