WordPress.org

Ready to get started?Download WordPress

Forums

Peter's Post Notes
Use filters for configurable settings instead (5 posts)

  1. Helen Hou-Sandi
    WordPress Dev
    Posted 1 year ago #

    Plugin file advises users to edit it directly to change settings. These are wiped out any time the plugin updates, and is not portable across environments, etc. So, for example, you could/should do:

    $ppn_post_types = apply_filters( 'ppn_post_types', array( 'post', 'page' ) );

    Then one could do:

    add_filter( 'ppn_post_types', 'my_ppn_post_types' );
    function my_ppn_post_types( $post_types ) {
    	$post_types[] = 'cpt-slug';
    	return $post_types;
    }

    http://wordpress.org/extend/plugins/peters-post-notes/

  2. Peter
    Member
    Plugin Author

    Posted 1 year ago #

    You are right -- it needs to be less destructive on update. I will have to add that to a future version, probably via a UI to manage the settings and save them in the WordPress options table.

  3. Helen Hou-Sandi
    WordPress Dev
    Posted 1 year ago #

    UI could be nice if you think it's a common usage, but a filter is a pretty quick change and would be a good idea anyway, for devs who need to control across environments without having to set up the plugin via UI every time (e.g. local, staging, and production).

  4. Peter
    Member
    Plugin Author

    Posted 1 year ago #

    Another good point :)

    Although, if the UI is backed by the wp_options table, then you can make life a bit easier by scripting the updates to the table.

    Still, something I'll have to consider. Thanks!

  5. Helen Hou-Sandi
    WordPress Dev
    Posted 1 year ago #

    DB syncing across environments is often asking for trouble :) Anyway, thanks for the consideration!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.