WordPress at a glance
function is not described


CssConcatenator::getOrCreateMediaRuleToAppendTo() private WC 1.0

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

No Hooks.


\stdClass. Object with properties as described for elements of $mediaRules.


// private - for code of main (parent) class only
$result = $this->getOrCreateMediaRuleToAppendTo( $media );
$media(string) (required)
The media query for rules to be appended, e.g. "@media screen and (max-width:639px)", or an empty string if none.

Code of CssConcatenator::getOrCreateMediaRuleToAppendTo() WC 5.4.1

private function getOrCreateMediaRuleToAppendTo($media)
    $lastMediaRule = \end($this->mediaRules);
    if ($lastMediaRule !== false && $media === $lastMediaRule->media) {
        return $lastMediaRule;

    $newMediaRule = (object)[
        'media' => $media,
        'ruleBlocks' => [],
    $this->mediaRules[] = $newMediaRule;
    return $newMediaRule;