Ask your WordPress questions! Pay money and get answers fast! (more info)

How can i add query_var to custom buddypress page? WordPress

  • REFUNDED

Hi,
I added a new page to buddypress with <strong>bp_core_new_subnav_item</strong>.
Lets say its adress:
/members/myname/example/

I want this page to handle a custom query_var. While its working like this:
/members/myname/example/?query=variable
but its not working like this:
/members/myname/example/query/variable/

I tried to use <strong>bp_pre_user_query_construct</strong> but couldnt success. Any ideas?

I asked same question in [[LINK href="https://buddypress.org/support/topic/how-can-i-add-query_var-to-custom-buddypress-page/#post-201018"]]buddypress forum[[/LINK]] and got a tip:

<blockquote>Look at <strong>$bp->action_variables</strong> array

https://codex.buddypress.org/developer/the-bp-global/</blockquote>

I couldnt find an example. I want an example code for this.

Answers (1)

2014-09-30

Dbranes answers:

Did you try to create an <em>endpoint</em> (untested), for example:

function wpq_add_endpoint() {
add_rewrite_endpoint( 'query', EP_PAGES );
}
add_action( 'init', 'wpq_add_endpoint' );



See the Codex:

http://codex.wordpress.org/Rewrite_API/add_rewrite_endpoint

PS: Maybe the following plugin can give you a hint how to add endpoints in BP:

[[LINK href="https://github.com/modemlooper/BP-API"]]https://github.com/modemlooper/BP-API[[/LINK]]


√únsal Korkmaz comments:

I am sorry but i really need a working example