Skip to content

Instantly share code, notes, and snippets.

@jrevillini

jrevillini/bp-custom.php

Last active Jul 15, 2019
Embed
What would you like to do?
BBPress / REDIRECT REPLY POSTS TO TOPIC WITH REPLY ANCHOR
<?php
// ---------------------------------------- REDIRECT REPLY POSTS TO TOPIC WITH REPLY ANCHOR
function jrevillini_reply_redirect( $wp_query ) {
if ( !function_exists('bbp_get_reply_url') ) return; // skip this if bbpress not active
if ( !isset($wp_query->query['reply']) ) return; // skip if not a bbpress reply page
if ( isset($wp_query->query['edit']) ) return; //skip if we are EDITING a bbpress reply
wp_safe_redirect( bbp_get_reply_url( $wp_query->query['reply'] ) );
}
add_action('pre_get_posts', 'jrevillini_reply_redirect');
@blogxkomo

This comment has been minimized.

Copy link

@blogxkomo blogxkomo commented Jul 3, 2019

Where this code must to input?
Can you help me

@jrevillini

This comment has been minimized.

Copy link
Owner Author

@jrevillini jrevillini commented Jul 3, 2019

You can put it in functions.php but it may be easier for you to use the code snippets plugin like this: http://tinyurl.com/y49p67as

@blogxkomo

This comment has been minimized.

Copy link

@blogxkomo blogxkomo commented Jul 3, 2019

but i've already add that code to functions.php, and then my website down can't to be access.

i don't know why it's happened

@jrevillini

This comment has been minimized.

Copy link
Owner Author

@jrevillini jrevillini commented Jul 15, 2019

If you give me the error generated in your error_log file I'm sure we can troubleshoot this. I'm pretty sure the code works as others have implemented it with success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.