Skip to content

Function

Determine whether to use permalinks or not.

tml_use_permalinks( )

Return

bool Whether to use permalinks or not.

Source

function tml_use_permalinks() {
    global $wp_rewrite;

    if ( ! $wp_rewrite instanceof WP_Rewrite ) {
        $wp_rewrite = new WP_Rewrite(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- lazily instantiates the same global WP core itself sets unconditionally at bootstrap (`$GLOBALS['wp_rewrite'] = new WP_Rewrite();` in wp-settings.php), for callers that may run before that point.
    }

    $use_permalinks = $wp_rewrite->using_permalinks() && get_site_option( 'tml_use_permalinks', true );

    /**
     * Filter whether to use permalinks or not.
     *
     * @since 7.0
     *
     * @param bool $use_permalinks Whether to use permalinks or not.
     */
    return (bool) apply_filters( 'tml_use_permalinks', $use_permalinks );
}

Uses

Used by

Changelog

VersionDescription
7.0 Introduced.