I have a hash tag I need to process. My Javascript gets it, reformats it a little, and now I need to redirect to a page with that hashtag. However, the hashtag is the name of the post, and WordPress is set up to have its urls with the date of the post. So I need to send a request to the DB to either redirect to the post, or get the url or ID of the post then use javascript to redirect..
Thanks sooo much for your help!
A hash tag is a means of indicating a search term in a twitter message. I think you mean a fragment identifier.
Fragment identifiers are handled client side and are not sent to the server when a URL is requested.
If you want to get that data from them you must parse the URI in JavaScript (see
location.hash
) and make a new HTTP request to the server that includes it as data.It is not recommended to use fragment identifiers when it makes sense for the server to know about their content on the initial request.
I’m not sure I understand. If you want to know how to get the permalink based on the title of a post, then send it to the server, call get_page_by_title and return get_permalink.