Ecommerce Shopify WordPress Discussion

Getting Post, Page, CPT and Archive page IDs using URL

I am currently using url_to_postid() to get the ID from the URL which is later used to get the other language page in WPML using that ID. $last_visited_id = url_to_postid( $last_visited_url ); This also works fine for getting Post ID, Page ID, and CPT ID. But the issue is getting the archive page URLs like Blog Page, Shop page, etc. As url_to_postid() function returns 0 for or pages, I cannot get the respective language pages in WPML. I tried using the below function as well. Here the issue is, that I don't have the POST TYPE value and also this doesn't work for the BLOG Archive or Shop Archive page. get_page_by_path($page_path, $output, $post_type);
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.