I'm making a wordpress plugin. I've used add_query_string() inside anchors in order to load content based on what link the user has clicked. Now I need to know the best way to get the parameter value in the current URI.
It's probably a pretty basic and stupid question, but I'm new to programming so I'm sorry if I misinterpret some terms.
This is the code:
if ( current_user_can('manage_options') ) {
echo (
'<div>
<ul>
<li><a href="'.add_query_arg( 'adminoption', 1 ).'">option 1</a></li>
<li><a href="'.add_query_arg( 'adminoption', 2 ).'">option 2</a></li>
</ul>
</div>'
);
// if adminoption == 1 load content A
// if adminoption == 2 load content B
}
Raising hidden answer in the comments by David Carrus:
Anyway you may try with the old php $_GET['adminoption'].
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With