Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting querystring parameter value in wordpress

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

        }
like image 833
rzb Avatar asked Jul 11 '12 22:07

rzb


1 Answers

Raising hidden answer in the comments by David Carrus:

Anyway you may try with the old php $_GET['adminoption'].

like image 156
Taylored Web Sites Avatar answered Oct 09 '22 17:10

Taylored Web Sites