mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- code review;
This commit is contained in:
@@ -30,18 +30,11 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
|
||||
* Permalinks constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
|
||||
add_action( 'init', array( &$this, 'set_current_url' ), 0 );
|
||||
|
||||
add_action( 'init', array( &$this, 'check_for_querystrings' ), 1 );
|
||||
|
||||
add_action( 'init', array( &$this, 'activate_account_via_email_link' ), 1 );
|
||||
|
||||
//add_action( 'um_user_after_updating_profile', array( &$this, 'profile_url' ), 1 );
|
||||
|
||||
/* @deprecated since version 2.1.7 */
|
||||
//remove_action( 'wp_head', 'rel_canonical' );
|
||||
//add_action( 'wp_head', array( &$this, 'um_rel_canonical_' ), 9 );
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +48,9 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
|
||||
|
||||
/**
|
||||
* SEO canonical href bugfix
|
||||
*
|
||||
* @deprecated since version 2.1.7
|
||||
*
|
||||
* @see function um_profile_remove_wpseo()
|
||||
*/
|
||||
function um_rel_canonical_() {
|
||||
|
||||
@@ -609,10 +609,10 @@ if ( !function_exists( 'um_profile_remove_wpseo' ) ) {
|
||||
remove_all_filters( 'wpseo_head' );
|
||||
|
||||
/* Restore title and canonical if broken */
|
||||
if( ! has_action( 'wp_head', '_wp_render_title_tag' ) ){
|
||||
if ( ! has_action( 'wp_head', '_wp_render_title_tag' ) ) {
|
||||
add_action( 'wp_head', '_wp_render_title_tag', 18 );
|
||||
}
|
||||
if( ! has_action( 'wp_head', 'rel_canonical' ) ){
|
||||
if ( ! has_action( 'wp_head', 'rel_canonical' ) ) {
|
||||
add_action( 'wp_head', 'rel_canonical', 18 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,9 +84,8 @@ add_filter( 'the_title', 'um_dynamic_user_profile_title', 100000, 2 );
|
||||
* @param WP_Post $post Optional. Post ID or object. Default is global `$post`.
|
||||
* @return string|false The canonical URL, or false if current URL is canonical.
|
||||
*/
|
||||
function um_get_canonical_url( $canonical_url, $post ){
|
||||
|
||||
if( UM()->config()->permalinks['user'] == $post->ID ) {
|
||||
function um_get_canonical_url( $canonical_url, $post ) {
|
||||
if ( UM()->config()->permalinks['user'] == $post->ID ) {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
@@ -109,13 +108,13 @@ function um_get_canonical_url( $canonical_url, $post ){
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$enable_canonical = apply_filters( "um_allow_canonical__filter", true );
|
||||
$enable_canonical = apply_filters( 'um_allow_canonical__filter', true );
|
||||
|
||||
if( $enable_canonical ){
|
||||
if ( $enable_canonical ) {
|
||||
$url = um_user_profile_url( um_get_requested_user() );
|
||||
$canonical_url = $url === home_url( $_SERVER['REQUEST_URI'] ) ? false : $url;
|
||||
$canonical_url = ( $url === home_url( $_SERVER['REQUEST_URI'] ) ) ? false : $url;
|
||||
|
||||
if ( $page = get_query_var('cpage') ){
|
||||
if ( $page = get_query_var( 'cpage' ) ) {
|
||||
$canonical_url = get_comments_pagenum_link( $page );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user