Remove SMOF options from the database

If you are a developer like me that is trying to do away with the Slightly Modified Options Framework from a site, or you are changing themes all together and the SMOF options don’t apply; the following code allows you to Export SMOF options to the dashboard  as a custom post type, then you can delete them all.  This will Remove SMOF options from the database, but not all of them, 2 rows which I will list ASAP are left in the wp_options table.

IMPORTANT!  You must remove the reference to the SMOF Files in your functions.php before you can delete the options, otherwise they will just reload instantly.

add_action( 'init', 'register_cpt_lwi_options' );
function register_cpt_lwi_options () {
        register_post_type( 'options', array(
            'labels' => array(
                'name' => __( 'Options' ),
            'public' => true,
            'show_ui' => true,
            'show_in_menu' => true,
            'capability_type' => 'post',
            'hierarchical' => false,
            'rewrite' => false,
            'supports' => array( 'title', 'editor' ), 
            'query_var' => false,
            'can_export' => true,
            'show_in_nav_menus' => false
        ) );

Posted in


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.