Recent

Settings_Command class Pro only

Settings_Command

Manage Top 10 plugin settings.

EXAMPLES

# Get a setting value
$ wp top10 settings get cache

# Set a setting value
$ wp top10 settings set cache 1 --type=int

Namespace: WebberZone\Top_Ten\Pro\CLI
Since: 4.3.0
Source: includes/cli/class-settings-command.php line 29 Extends: Base_Command

Methods

get()

Get a specific setting value.

OPTIONS

: Setting key to retrieve.

[—format=] : Output format (table, json, csv, value). Default: value.

[—network] : Get the setting for all sites in the network.

[—blog-id=] : Specific blog ID to get the setting from (multisite only).

EXAMPLES

wp top10 settings get cache
wp top10 settings get post_count_column --format=json
wp top10 settings get cache --network

Line: 57

public function get( array $args, array $assoc_args ): void;
TypeNameDescription
array$argsCommand arguments.
array$assoc_argsCommand associative arguments.

Returns: void

set()

Set a specific setting value.

OPTIONS

: Setting key to update. : New value.

[—type=] : Value type (string, int, float, bool, array). Default: auto-detect.

[—dry-run] : Show what would change without updating.

[—network] : Set the setting for all sites in the network.

[—blog-id=] : Specific blog ID to update the setting for (multisite only).

EXAMPLES

wp top10 settings set cache 1 --type=int
wp top10 settings set post_title_length 60
wp top10 settings set cache_time 3600 --type=int
wp top10 settings set cache 1 --network

Line: 131

public function set( array $args, array $assoc_args ): void;
TypeNameDescription
array$argsCommand arguments.
array$assoc_argsCommand associative arguments.

Returns: void

export()

Export all Top 10 settings to a JSON file.

OPTIONS

[—file=] : Output file path. Default: tptn-settings-{timestamp}.json (or tptn-settings-{blog_id}-{timestamp}.json for multisite).

[—dry-run] : Show what would be exported without writing the file.

[—network] : Export settings for all sites in the network.

[—blog-id=] : Specific blog ID to export settings for (multisite only).

EXAMPLES

wp top10 settings export
wp top10 settings export --file=my-settings.json
wp top10 settings export --network
wp top10 settings export --dry-run

Line: 207

public function export( array $args, array $assoc_args ): void;
TypeNameDescription
array$argsCommand arguments.
array$assoc_argsCommand associative arguments.

Returns: void

import()

Import Top 10 settings from a JSON file.

OPTIONS

: Path to the JSON file to import.

[—merge] : Merge with existing settings instead of replacing.

[—dry-run] : Show what would be imported without making changes.

[—network] : Import settings for all sites in the network.

[—blog-id=] : Specific blog ID to import settings for (multisite only).

EXAMPLES

wp top10 settings import settings.json
wp top10 settings import settings.json --merge
wp top10 settings import settings.json --dry-run
wp top10 settings import settings.json --network

Line: 292

public function import( array $args, array $assoc_args ): void;
TypeNameDescription
array$argsCommand arguments.
array$assoc_argsCommand associative arguments.

Returns: void

copy()

Copy settings from one site to another or all sites on a multisite network.

OPTIONS

[—source=] : Source blog ID. Default: current site.

[—destination=] : Destination blog ID(s), comma-separated, or “all” for all other sites.

[—dry-run] : Show what would be copied without making changes.

EXAMPLES

# Copy from current site to site 3
$ wp top10 settings copy --destination=3

# Copy from site 2 to sites 3 and 4
$ wp top10 settings copy --source=2 --destination=3,4

# Copy from current site to all other sites
$ wp top10 settings copy --destination=all

# Copy from site 1 to all other sites
$ wp top10 settings copy --source=1 --destination=all

Line: 387

public function copy( array $args, array $assoc_args ): void;
TypeNameDescription
array$argsCommand arguments.
array$assoc_argsCommand associative arguments.

Returns: void