### Get Global SEO Settings with WP-CLI Source: https://www.seopress.org/support/guides/seopress-wp-cli Retrieves global SEO settings from WordPress options. This command requires the specific option name to fetch. For example, 'seopress_titles_option_name' can be used to get all global titles and meta settings. ```bash wp option get option_name ``` ```bash wp option get seopress_titles_option_name ``` -------------------------------- ### Install SEOPress PRO with Composer Source: https://www.seopress.org/support/guides/use-composer-with-seopress-pro This snippet shows the `composer.json` file configuration required to install SEOPress PRO. It defines a package repository for SEOPress PRO, specifies the package details including version and download URL, and sets up installation paths. The `require` section ensures SEOPress PRO is listed as a dependency. The `config.allow-plugins` section is crucial for enabling the composer/installers plugin. ```json { "repositories": [ { "type": "package", "package": { "name": "wp-seopress-pro/wp-seopress-pro", "version": "8.6.1", "type": "wordpress-plugin", "dist": { "url": "https://www.seopress.org/?edd_composer_download=1&license_key=xxxxxxxxxxxx&version=8.6.1&lang=en&url=https://example.com", "type": "zip" }, "require": { "composer/installers": "^1.0" } } } ], "require": { "wp-seopress-pro/wp-seopress-pro": "*" }, "extra": { "installer-paths": { "wp-content/plugins/{$name}/": ["type:wordpress-plugin"] } }, "config": { "allow-plugins": { "composer/installers": true } } } ``` -------------------------------- ### Run Composer Installation Command Source: https://www.seopress.org/support/guides/use-composer-with-seopress-pro This command is used in the terminal to add SEOPress PRO as a dependency to your project using Composer. It fetches the package defined in your `composer.json` file and installs it according to the specified paths. ```bash composer require wp-seopress-pro/wp-seopress-pro ``` -------------------------------- ### Manage Term SEO Metadata via WP-CLI Source: https://www.seopress.org/support/guides/seopress-wp-cli Allows getting, updating, or deleting SEO metadata for terms. The commands are similar to post metadata commands, replacing 'post' with 'term'. ```bash # Example for getting term meta wp term meta get # Example for updating term meta wp term meta update # Example for deleting term meta wp term meta delete ``` -------------------------------- ### Get Post SEO Metadata via WP-CLI Source: https://www.seopress.org/support/guides/seopress-wp-cli Retrieves specific SEO metadata for a given post ID and meta key. Requires the post ID and the meta key name as arguments. ```bash wp post meta get wp post meta get 123 _seopress_titles_title ``` -------------------------------- ### Enable XML Sitemap in SEOPress Source: https://www.seopress.org/support/guides/wordpress-site-migration-without-breaking-your-seo-part-2 This snippet shows how to enable the XML sitemap feature within the SEOPress plugin for WordPress. Enabling this helps in rapidly indexing the new site in Google. It requires the SEOPress plugin to be installed and active. ```text Go to SEO, XML Sitemap. Check Enable XML Sitemap and Save changes. ``` -------------------------------- ### Basic WordPress .htaccess Configuration Source: https://www.seopress.org/support/guides/wordpress-site-migration-without-breaking-your-seo-part-2 This code snippet represents the default WordPress configuration for the .htaccess file, which is crucial for handling rewrite rules and routing requests. It ensures that WordPress can correctly process permalinks and other URL structures. This configuration is typically found in the root directory of a WordPress installation. ```apache # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] ``` -------------------------------- ### GET /wp-json/seopress/v1/matomo Source: https://www.seopress.org/support/guides/get-started-with-the-seopress-rest-api Retrieves Matomo Analytics statistics. ```APIDOC ## GET /wp-json/seopress/v1/matomo ### Description Requests Matomo Analytics stats. Requires user to have `edit_dashboard` capability. ### Method GET ### Endpoint /wp-json/seopress/v1/matomo ### Response #### Success Response (200) - Returns a JSON object with all Matomo metrics per date. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Get Parent Terms Title for Archive Pages in SEOPress Source: https://www.seopress.org/support/guides/create-your-custom-dynamic-variable-for-your-meta-title-description-social This example shows how to retrieve and display the list of parent terms for the current taxonomy on archive pages within SEOPress. It uses WordPress functions like `get_queried_object`, `get_term_parents_list`, and SEOPress filters to register and replace the `%%parent_terms_title%%` variable. This code is intended for use within a WordPress environment. ```php function sp_titles_template_variables_array($array) { $array[] = '%%parent_terms_title%%'; return $array; } add_filter('seopress_titles_template_variables_array', 'sp_titles_template_variables_array'); function sp_titles_template_replace_array($array) { $queried_object = get_queried_object(); $term_id = $queried_object->term_id; $tax = $queried_object->taxonomy; $args = [ 'format' => 'name', 'separator' => ', ', 'link' => false, 'inclusive' => false ]; $ancestors = get_term_parents_list($term_id, $tax, $args); if ($ancestors && is_string($ancestors)) { $array[] = esc_attr(wp_strip_all_tags($ancestors)); } return $array; } add_filter('seopress_titles_template_replace_array', 'sp_titles_template_replace_array'); function sp_get_dynamic_variables($array){ $array['%%parent_terms_title%%'] = __('Parent terms title', 'my-text-domain'); return $array; } add_filter('seopress_get_dynamic_variables', 'sp_get_dynamic_variables'); ``` -------------------------------- ### Custom JSON-LD Schema Example (JavaScript) Source: https://www.seopress.org/support/guides/create-custom-schema-json-ld-seopress-pro This snippet demonstrates a basic custom schema in JSON-LD format, specifically for a 'Recipe'. It includes essential properties like name, author, datePublished, description, and prepTime. This code should be placed within ` ``` -------------------------------- ### HTML Tags for Breadcrumb Translation Source: https://www.seopress.org/support/guides/translate-breadcrumbs This snippet shows example HTML tags that can be used when setting up display text before breadcrumbs in SEOPress. These tags allow for basic text formatting. ```html

``` -------------------------------- ### Import SEOPress Settings via WP-CLI Source: https://www.seopress.org/support/guides/seopress-wp-cli Imports all SEOPress global settings from a specified source folder. The default source is the wp-content/uploads directory. ```bash wp seopress settings import wp seopress settings import --from='/home/home/example/public_html/wp-content/uploads/seopress' ``` -------------------------------- ### Add SEOPress PRO License Key to wp-config.php Source: https://www.seopress.org/support/guides/activate-seopress-pro-license This code snippet demonstrates how to define the SEOPress PRO license key directly in the wp-config.php file. This method stores the license key in the configuration file instead of the database, offering an alternative activation approach. SEOPress PRO will automatically attempt to activate the license if this define is detected. ```php define( 'SEOPRESS_LICENSE_KEY', 'XXXXXXX' ); ``` -------------------------------- ### Robots.txt Configuration for Discoverability Source: https://www.seopress.org/support/guides/wordpress-site-migration-without-breaking-your-seo This robots.txt configuration ensures that search engines can discover all pages on your site, even those with NOINDEX tags. It is recommended by Google as a way to allow crawling while still respecting indexing directives. ```robots.txt User-agent: * Allow: / ``` -------------------------------- ### Delete Global SEO Settings with WP-CLI Source: https://www.seopress.org/support/guides/seopress-wp-cli Deletes global SEO settings from WordPress options. This command requires the option name to be specified. For example, 'seopress_titles_option_name' can be used to delete all associated global titles and meta settings. ```bash wp option delete option_name ``` ```bash wp option delete seopress_titles_option_name ``` -------------------------------- ### Get WordPress Document Title Tag Source: https://www.seopress.org/support/guides/get-document-title-tag-current-page This snippet shows how to retrieve the document's title tag within a WordPress template file, such as header.php. It utilizes a native WordPress function for simplicity and effectiveness. ```php ``` -------------------------------- ### Generate AI Metadata with SEOPress CLI Source: https://www.seopress.org/support/guides/seopress-wp-cli Generates meta titles and descriptions for posts using AI. Accepts a list of post IDs and an optional language code. The 'meta' parameter can specify 'title' or 'desc' for targeted generation. ```bash wp seopress ai metadata --id=1 ``` ```bash wp seopress ai metadata --id=1,2,3,4,5 --meta=desc --language=fr_FR ``` -------------------------------- ### Define Value for Custom Dynamic Variable (PHP) Source: https://www.seopress.org/support/guides/create-your-custom-dynamic-variable-for-your-meta-title-description-social This code snippet defines the value that will be displayed for a registered custom dynamic variable. It hooks into the 'seopress_titles_template_replace_array' filter and uses esc_attr(wp_strip_all_tags()) to ensure the data is properly escaped for security. The string 'Best WordPress SEO plugin' is an example value. ```php function sp_titles_template_replace_array($array) { //escape your values! $array[] = esc_attr(wp_strip_all_tags('Best WordPress SEO plugin')); return $array; } add_filter('seopress_titles_template_replace_array', 'sp_titles_template_replace_array'); ```