Reputation: 358
Can I pass numbers as parameters in URL? I am trying to get the slug name as below,
$slug = $post->post_name;
$pagePath = site_url() . '/listing-details/?p=' . $slug;
and trying to get the slug as below,
$the_slug = $_GET['p'];
Now the issue here, in some cases I am getting the $slug value as something like
650-jefferson-ave
Thus finally my URL which I am getting, becomes:
http://localhost/project/listing-details/?p=650-jefferson-ave
Thus in that case my $the_$slug is returning null and this url is redirecting the default http://localhost/project/listing-details/ page without any parameters.
How can I achieve this? Please anyone help.
Upvotes: 2
Views: 299
Reputation: 27503
$parts = parse_url($url);
parse_str($parts['query'], $query);
echo $query['email'];
and make sure you have a parameter p
after your url
like
/post/?p=something
Upvotes: 1