• Resolved Ignacio

    (@iignacio)


    Hey,

    Is there a way to enable post order (options-general.php?page=scporder-settings) programmatically, for a certain post type?

    I’d like to enable SCP for taxonomies via functions.php for example.

    Thanks

    • This topic was modified 5 years, 9 months ago by Ignacio.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @iignacio,

    You can do this by filtering get_option: https://codex.wordpress.org/Plugin_API/Filter_Reference/option_(option_name)
    The option’s name where they are stored is: scporder_options
    which is an array and in ‘objects’ will keep all the custom posts and in ‘tags’ the taxonomies.

    All the best,
    Mihaela

    • This reply was modified 5 years, 9 months ago by Miha.
    Thread Starter Ignacio

    (@iignacio)

    Hi @mplusb, thanks for your quick reply.

    After digging into the plugin’s code I ended up doing what you suggest. Here’s the code in case someone finds it useful.

    if (is_plugin_active('simple-custom-post-order/simple-custom-post-order.php')) {
        if (!get_option('scporder_options')) {
            update_option('scporder_options', array('objects' => '', 'tags' => array('category')));
        }
    }

    Would it make sense to have a function set this programmatically?
    Like scp_enable('tags' => array('category'))

    Thanks again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Enable Post Order programmatically’ is closed to new replies.