publicize_checkbox_default

Filter the checkbox state of each Publicize connection appearing in the post editor.

Description

apply_filters( 'publicize_checkbox_default', (bool) $checked, (int) $post_id, (string) $name, (array) $connection ); 

Parameters (4)

0. $checked (bool)
Should the Publicize checkbox be enabled for a given service.
1. $post_id (int)
The post id.
2. $name (string)
Service name.
3. $connection (array)
Array of connection details.

Usage

To run the hook, copy the example below.
  1. $checked = apply_filters( 'publicize_checkbox_default', $checked, $post_id, $name, $connection ); 
  2.  
  3. if ( !empty( $checked ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the publicize_checkbox_default callback 
  2. function filter_publicize_checkbox_default( $checked, $post_id, $name, $connection ) { 
  3. // make filter magic happen here... 
  4. return $checked
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'publicize_checkbox_default', 'filter_publicize_checkbox_default', 10, 4 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'publicize_checkbox_default', 'filter_publicize_checkbox_default', 10, 4 ); 

Defined (1)

The filter is defined in the following location(s).

/modules/publicize/ui.php  
  1. $checked = apply_filters( 'publicize_checkbox_default', $checked, $post->ID, $name, $connection );