The-seo-framework: wp-cli for The SEO Framework

Created on 17 Jun 2019  路  3Comments  路  Source: sybrew/the-seo-framework

Hey there dear SEO Framework guys!

i really like your framework a lot and i first want to give you props for the good and free (!!!) software that you create for all of us. As i am one of the persons who experiments a lot with wordpress and woocommerce, i also destroy a lot. Due to issues that can arise and destroy my environment, i decided to start scripting my pages with WP-CLI and it helps me a lot to get my sites up and running again.
It would be a really great feature, if it was possible to change The SEO Framework settings using WP-CLI. However, i could not find a way to do so right now.

Would you like to implement this as a new great feature? (I think a lot of people might like it)

Keep up the good work and have a nice day/night :)

[Status] Feedback required [Type] Feature

Most helpful comment

We may want to add WP-CLI commands:

if ( defined( 'WP_CLI' ) && WP_CLI ) {
    WP_CLI::add_command( 'tsf', 'callback' );
    WP_CLI::add_command( 'tsf something', 'callback_to_something' );
}

I don't use WP-CLI myself; so, any feedback would be helpful.

All 3 comments

Hello @ratzrattillo

I'm happy to see your enthusiasm!

We use the WordPress options API.
https://developer.wordpress.org/cli/commands/option/

However, as we work with one single option storing a bulk of settings (EAV model), we had to implement an API on top of that; to streamline the process towards it.

Via the the_seo_framework() function, you can access most of the API.
For example:

the_seo_framework()->get_default_site_options();    // Gets default site options.
the_seo_framework()->get_all_options();             // Gets all options you've set.
the_seo_framework()->get_option( $key );            // Gets a single option.
the_seo_framework()->update_option( $key, $value ); // Sets a single option.
the_seo_framework()->update_settings( $options );   // Sets an array of options, merges with current.

I hope this gets you started! Feel free to reach out if you require a little more help. :)

We may want to add WP-CLI commands:

if ( defined( 'WP_CLI' ) && WP_CLI ) {
    WP_CLI::add_command( 'tsf', 'callback' );
    WP_CLI::add_command( 'tsf something', 'callback_to_something' );
}

I don't use WP-CLI myself; so, any feedback would be helpful.

Hello @sybrew

i just checked the options settings and this already seems to be a pretty good alternative for me to get things going. Thank you very much!
The command to show the settings is: "wp option get autodescription-site-settings"

However, your suggestions of the CLI changes are of course prettier. E.g. something like:
wp tsf general
wp tsf meta
wp tsf homepage

I will try to learn more about SEO with tsf and maybe we can find a really nice categorization, which makes up useful, structured commands!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sybrew picture sybrew  路  6Comments

LeBaux picture LeBaux  路  6Comments

9585999 picture 9585999  路  5Comments

alpipego picture alpipego  路  4Comments

SchneiderSam picture SchneiderSam  路  3Comments