WordPress – get_permalink to return page_id instead of slug in %postname% permalink setting

So, I have wordpress site with http://example.com/%postname%/ in permalink setting.

I want to echo get_permalink(), which showing http://example.com/?page_id=xx result

Read More

but when I did echo get_permalink(), it’s return http://example.com/some-slug/. I know it’s not an error because the permalink setting is %postname%.

I want to use it like this :
echo '<a href="'. get_permalink() .'&get_weather='. $weather .'"></a>';

to make link result like this :
<a href="http://example.com/?page_id=1&get_weather=rain"></a>

instead of this result:
<a href="http://example.com/some-slug/&get_weather=rain"></a>

So, is it possible to get result of http://example.com/?page_id=xx
while echo-ing get_permalink() with %postname% (or other permalink setting option) as the permalink
setting? please explain how

Thanks.

Related posts

Leave a Reply

1 comment