Solved

get var? after hashtag from url

Posted on 2014-11-20
2
174 Views
Last Modified: 2014-11-20
I used to have  a wordpress plugin that, when being used, would include a ? in the url.

I would test for that var it used, and adjust my code accordingly, to display certain things, like this:

if ( isset( $wp_query->query_vars['sample'] ) ) {

I just updated the plugin and now, instead of having a ?, then have a hashtag, and then the var I need to look for.

Apparently, my 'if' is not triggered anymore, so I'm thinking the change makes it not a query var.

So... with it as a hashtag, how can I write an if for it?

Thanks for any help,

Chris
0
Comment
Question by:St_Aug_Beach_Bum
2 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40456626
Anything after the hashtag is only available at the browser and is not sent back to the server.
Your only real option is, depending on the scenario, use js to get the hashtag and store it in an input, for example if you were submitting a form, so you can grab the input value at the server.
0
 

Author Comment

by:St_Aug_Beach_Bum
ID: 40456639
Ohh... bummer. Yeh, going to have to rethink this.

The plugin author has been very receptive to feedback, I'll ask her to see if she can give me a better solution.

Thank you very much!

Chris
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question