WordPress at Your Fingertips
function is not described

WP_Theme_JSON::append_to_selector() private WP 5.8.0

Function that appends a sub-selector to a existing one.

Given the compounded $selector "h1, h2, h3" and the $to_append selector ".some-class" the result will be "h1.some-class, h2.some-class, h3.some-class".

{} It's a method of the class: WP_Theme_JSON{}

No Hooks.

Return

String.

Usage

$result = WP_Theme_JSON::append_to_selector( $selector, $to_append );
$selector(string) (required)
Original selector.
$to_append(string) (required)
Selector to append.

Changelog

Since 5.8.0 Introduced.

Code of WP_Theme_JSON::append_to_selector() WP 5.8.2

private static function append_to_selector( $selector, $to_append ) {
	$new_selectors = array();
	$selectors     = explode( ',', $selector );
	foreach ( $selectors as $sel ) {
		$new_selectors[] = $sel . $to_append;
	}

	return implode( ',', $new_selectors );
}