Skip to content Skip to navigation

SEOPress & WP-CLI

SEOPress PRO 6.8 is required for the dedicated SEOPress commands.

Exporting settings to a JSON file

wp seopress settings export

Examples

  • Exports all SEOPress global settings to the wp-content/uploads/seopress directory.
    wp seopress settings export --destination='/home/example/public_html/wp-content/uploads/seopress'

Parameters

Argument Description
[--destination=<value>] The path to the destination folder. Default: wp-content/uploads directory.

Import settings from a JSON file

wp seopress settings import

Examples

  • Imports all SEOPress global settings from the wp-content/uploads/seopress directory.
    wp seopress settings import --from='/home/example/public_html/wp-content/uploads/seopress'

Parameters

Argument Description
[--from=<value>] The path of the source folder. Default: wp-content/uploads directory.

CLI for SEO metadata

These commands are available with WordPress out of the box. More info on official website.

Get any SEO metadata

Read this guide to find the desired post meta key.

wp post meta get 123 meta_name

Examples

  • Get the SEO title for post ID equals to 123:
    wp post meta get 123 _seopress_titles_title

Parameters

Argument Description
<post_id> The post ID.
<post_meta_name> The post meta key.

Update any SEO metadata

wp post meta update 123 meta_name meta_value

Examples

  • Update the SEO title for post ID equals to 123 with this value “my super SEO title”:
    wp post meta update 123 _seopress_titles_title "my super SEO title"

Parameters

Argument Description
<post_id> The post ID.
<post_meta_name> The post meta key.
<post_meta_value> The post meta value.

Delete any SEO metadata

wp post meta delete 123 meta_name

Examples

  • Delete the SEO title for post ID equals to 123:
    wp post meta delete 123 _seopress_titles_title

Parameters

Argument Description
<post_id> The post ID.
<post_meta_name> The post meta key.

Get / update / delete term SEO metadata

The commands are identical to those listed below with one exception, post becomes term. More info here.

Generate SEO metadata (title / meta description) with AI and CLI

SEOPress PRO 7.0 is required for this + an OpenAI key.
wp seopress ai metadata --id=1

Examples

  • Generate meta description for a list of post IDs in French language
    wp seopress ai metadata --id=1,2,3,4,5 --meta=desc --language=fr_FR

Parameters

Argument Description
<id>
List of Post ID separated by comma.
<meta>
Which meta to generate. Accepted values: “title”, “desc”. Optional. Default if not specified: title + meta description.
<language>
Which language to use to generate the metadata. Optional. Default: en_US.
<autosave>
Boolean. Optional. Default: true

Generate alternative texts for SEO and accessibility with AI and CLI

SEOPress PRO 7.2 is required for this + an OpenAI key.
wp seopress ai alt_text --id=1

Examples

  • Generate alternative texts for a list of media IDs in French language
    wp seopress ai alt_text --id=1,2,3,4,5 --language=fr_FR

Parameters

Argument Description
<id>
List of Attachment ID separated by comma.
<language>
Which language to use to generate the metadata. Optional. Default: en_US.
<autosave>
Boolean. Optional. Default: true

CLI for global SEO settings

These commands are available with WordPress out of the box. More info on official website.

Get global SEO settings

wp option get option_name

Examples

  • Get all global Titles and metas settings:
    wp option get seopress_titles_option_name

Parameters

Argument Description
<option_name> The option key.

Update global SEO settings

wp option patch update option_name foo new

Examples

  • Update the global homepage title from Titles and metas settings with this value “my super homepage title”
    wp option patch update seopress_titles_option_name seopress_titles_home_site_title "my super homepage title"

Parameters

Argument Description
<option_name> The option key.
<key-path> The key of the nested array to patch.
<option_value> The option value.

Delete global SEO settings

wp option delete option_name

Examples

  • Delete all global Titles and metas settings:
    wp option delete seopress_titles_option_name

Parameters

Argument Description
<option_name> The option key.