Title: Filter for default settings
Last modified: November 25, 2016

---

# Filter for default settings

 *  [ninetienne](https://wordpress.org/support/users/ninetienne/)
 * (@ninetienne)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/filter-for-default-settings/)
 * Would be great if you could add a filter for default settings.
    We’re using your
   plugin in our themes and would like to choose ‘manual’ for location type right
   after the plugin’s installation / activation. Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [dFactory](https://wordpress.org/support/users/dfactory/)
 * (@dfactory)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/filter-for-default-settings/#post-8480636)
 * Hi,
    It’s not that easy as the options assignment happens in plugin class constructor.
   What you can do however is to detect the PVC activation using this: [https://codex.wordpress.org/Plugin_API/Action_Reference/activated_plugin](https://codex.wordpress.org/Plugin_API/Action_Reference/activated_plugin)
   And update the PVC post_views_counter_settings_display option.
 * Regards,
    Bartosz / dfactory team
 *  Thread Starter [ninetienne](https://wordpress.org/support/users/ninetienne/)
 * (@ninetienne)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/filter-for-default-settings/#post-8480651)
 * Seems like a solution.
 * Could you please provide some more details, how to update the post_views_counter_settings_display
   option? It’s a serialized array, and I’m afraid to mess it up.
 * Thanks a lot!
 *  Plugin Author [dFactory](https://wordpress.org/support/users/dfactory/)
 * (@dfactory)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/filter-for-default-settings/#post-8480908)
 * It would be something like this, but you have to test it:
 *     ```
       /**
        * Hook into activated_plugin action.
        * 
        * @param string $plugin
        */
       function custom_pvc_activation_action( $plugin ) {
       	// check if PVC constant is defined,use it to get PVC path anc compare to activated plugin
           if( defined( 'POST_VIEWS_COUNTER_PATH' ) && $plugin == plugin_basename( POST_VIEWS_COUNTER_PATH . 'post-views-counter.php' ) ) {
       		// get display options
       		$display_options = get_option( 'post_views_counter_settings_display' );
       		// set position value
       		$display_options['position'] = 'manual';
       		// update options
       		update_option( 'post_views_counter_settings_display', $display_options );
           }
       }
       add_action( 'activated_plugin', 'custom_pvc_activation_action' );
       ```
   
 *  Thread Starter [ninetienne](https://wordpress.org/support/users/ninetienne/)
 * (@ninetienne)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/filter-for-default-settings/#post-8480950)
 * Thank you so much!
 *  Thread Starter [ninetienne](https://wordpress.org/support/users/ninetienne/)
 * (@ninetienne)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/filter-for-default-settings/#post-8487341)
 * I’ve just tested it, and it’s working fine. Thanks a lot!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Filter for default settings’ is closed to new replies.

 * ![](https://ps.w.org/post-views-counter/assets/icon-256x256.png?rev=2973820)
 * [Post Views Counter](https://wordpress.org/plugins/post-views-counter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/post-views-counter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/post-views-counter/)
 * [Active Topics](https://wordpress.org/support/plugin/post-views-counter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-views-counter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-views-counter/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [ninetienne](https://wordpress.org/support/users/ninetienne/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/filter-for-default-settings/#post-8487341)
 * Status: not resolved