# charitable/1.8.13/includes/compat/charitable-permalink-manager-compat-functions.php

Charitable – Donation &amp; Fundraising Platform (Donation Forms, Recurring Donations &amp; Fundraising Campaigns), version 1.8.13. 40 lines.

- Page: https://pluginprobe.com/plugins/charitable/1.8.13/code/includes/compat/charitable-permalink-manager-compat-functions.php
- Raw: https://pluginprobe.com/plugins/charitable/1.8.13/raw/includes/compat/charitable-permalink-manager-compat-functions.php
- Modified: 2023-11-01T16:41:02+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/charitable/1.8.13/code/includes/compat/charitable-permalink-manager-compat-functions.php#L10-L20`.

```php
<?php
/**
 * Functions to improve compatibility with Permalink Manager.
 *
 * @package   Charitable/Functions/Compatibility
 * @author    David Bisset
 * @copyright Copyright (c) 2023, WP Charitable LLC
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since     1.6.41
 * @version   1.6.41
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * When the canonical redirect option is enabled in Permalink Manager
 * (it's on by default), the user is redirected from endpoints in Charitable
 * to the source page.
 *
 * @since  1.6.41
 *
 * @return void
 */
function charitable_compat_permalink_manager_block_canonical_redirects() {
	$helper    = charitable()->endpoints();
	$endpoints = [
		'forgot_password',
		'reset_password',
	];

	if ( in_array( $helper->get_current_endpoint(), $endpoints ) || $helper->get_endpoint( 'profile' )->is_descendent_page() ) {
		set_query_var( 'do_not_redirect', 1 );
	}
}

add_action( 'template_redirect', 'charitable_compat_permalink_manager_block_canonical_redirects', 0 );

```
