How to do it...

  1. Navigate to the ch2-twitter-embed folder of the WordPress plugin directory of your development installation.
  2. Open the ch2-twitter-embed.php file in a text editor.
  3. Add the following lines of code to implement an activation callback to initialize plugin options when it is installed or upgraded:
register_activation_hook( __FILE__,                           'ch2te_set_default_options_array' ); function ch2te_set_default_options_array() {    ch2te_get_options();}function ch2te_get_options( $id = 1 ) {    $options = get_option( 'ch2te_options_' . $id, array() );    $new_options['setting_name'] = 'Default';    $new_options['width'] = 560;    $new_options['number_of_tweets'] = 3;    $merged_options = wp_parse_args( $options, $new_options ); $compare_options = array_diff_key( ...

Get WordPress Plugin Development Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.