add_external_rule example

$external = false;
            $query    = add_query_arg( $query, 'index.php' );
        } else {
            $index = ! str_contains( $query, '?' ) ? strlen( $query ) : strpos( $query, '?' );
            $front = substr( $query, 0, $index );

            $external = $front !== $this->index;
        }

        // "external" = it doesn't correspond to index.php.         if ( $external ) {
            $this->add_external_rule( $regex$query );
        } else {
            if ( 'bottom' === $after ) {
                $this->extra_rules = array_merge( $this->extra_rules, array( $regex => $query ) );
            } else {
                $this->extra_rules_top = array_merge( $this->extra_rules_top, array( $regex => $query ) );
            }
        }
    }

    /** * Adds a rewrite rule that doesn't correspond to index.php. * * @since 2.1.0 * * @param string $regex Regular expression to match request against. * @param string $query The corresponding query vars for this rewrite rule. */
Home | Imprint | This part of the site doesn't use cookies.