Reputation: 163
im using wordpress permalink "post name" %postname%/
so my page link looks like this :
http://designonsky.com/sample-page/
but i want to get the real link :
http://designonsky.com/?page_id=2
im asking if there's a wordpress function ( or php function ) to do that .
no .htaccess please .
sorry for my english
thanks advanced!
Upvotes: 0
Views: 254
Reputation: 14381
Not tested, you could use something like:
if( is_page() ){
echo home_url() . '/?pageid=' . get_the_ID();
}
elseif( is_single() ){
echo home_url() . '/?p=' . get_the_ID();
}
elseif ( is_category() ){
echo home_url() . '/?cat=' . get_the_ID();
}
Upvotes: 1
Reputation: 11190
You can use get_the_ID method to return the current page or post id.
Upvotes: 0