AnsPress_Rewrite::shortlink()
Description #
Handles shortlink redirects.
Source #
File: includes/rewrite.php
public static function shortlink() { global $wp_query; $page = get_query_var( 'ap_page' ); if ( empty( $page ) || 'shortlink' !== $page ) { return; } $post_id = ap_isset_post_value( 'ap_q', ap_isset_post_value( 'ap_a', false ) ); $post_id = ap_isset_post_value( 'ap_p', $post_id ); // Post redirect. if ( $post_id ) { $permalink = get_permalink( $post_id ); wp_redirect( $permalink, 302 ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect exit; } // Comment redirect. if ( ap_isset_post_value( 'ap_c', false ) ) { $permalink = get_comment_link( ap_isset_post_value( 'ap_c' ) ); wp_redirect( $permalink, 302 ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect exit; } // User redirect. if ( ap_isset_post_value( 'ap_u', false ) ) { $permalink = ap_user_link( ap_isset_post_value( 'ap_u' ), ap_isset_post_value( 'sub' ) ); wp_redirect( $permalink, 302 ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect exit; } }
Expand full source code Collapse full source code View on GitHub: includes/rewrite.php:246
Add your comment