September 1, 2024
WordPress URL Handling Functions: A Complete Reference (Including WooCommerce)
In WordPress theme or plugin development, working with URLs is a fundamental taskβwhether for fetching resources, linking to specific user actions, or managing backend routes.
This article is a comprehensive list of commonly used WordPress and WooCommerce functions related to getting and handling URLs. It is organized by category for quick reference and developer convenience.
π§βπ» User Account Related
wp_login_url();
wp_logout_url();
wp_registration_url();
wp_lostpassword_url();
get_edit_user_link($user_id);
get_delete_user_link($user_id);
get_author_posts_url($author_id);
get_dashboard_url($user_id, $path);
get_site_url('/wp-login.php');
get_edit_profile_url();
admin_url('user-edit.php?user_id=' . $user_id);
admin_url('user-new.php');
π¨ Theme-Related Directories
get_stylesheet_directory_uri();
get_template_directory_uri();
get_locale_stylesheet_uri();
get_stylesheet_uri();
get_theme_file_uri();
get_parent_theme_file_uri();
get_theme_root_uri();
get_header_image();
get_background_image();
get_custom_logo();
wp_get_canonical_url();
π Post and Page URLs
get_permalink($post_id);
the_permalink();
get_the_permalink();
get_post_permalink($post_id);
get_page_link($post_id);
get_post_type_archive_link($post_type);
get_edit_post_link($post_id);
get_delete_post_link($post_id);
get_preview_post_link($post_id);
get_day_link($year, $month, $day);
get_month_link($year, $month);
get_year_link($year);
get_pagenum_link($pagenum);
get_attachment_link($attachment_id);
get_comments_link($post_id);
get_comment_link($comment);
get_post_comments_feed_link($post_id);
get_post_format_link($format);
get_the_post_thumbnail_url();
π Media & Attachments
wp_get_attachment_url();
get_attachment_link();
wp_get_attachment_thumb_url();
wp_get_attachment_image_url();
get_attachment_url();
get_icon_attachment_uri();
get_the_post_thumbnail_url();
π¬ Comment URLs
get_comments_link($post_id);
get_comment_link($comment);
get_edit_comment_link($comment_id);
get_delete_comment_link($comment_id);
get_post_comments_feed_link($post_id);
get_comment_reply_link($args, $comment, $post);
get_comments_pagenum_link($pagenum);
get_comment_author_url();
get_comment_author_url_link();
π Front-End URLs
home_url();
get_home_url();
site_url();
get_site_url();
content_url();
get_url_in_content();
get_avatar_url();
get_rest_url();
trackback_url();
get_trackback_url();
site_icon_url();
get_site_icon_url();
get_author_posts_url();
the_header_video_url();
βοΈ Admin & Backend
includes_url();
plugins_url();
admin_url();
get_admin_url();
get_dashboard_url();
menu_page_url();
network_admin_url();
network_site_url();
network_home_url();
plugin_dir_url();
self_admin_url();
user_admin_url();
wp_lostpassword_url();
trackback_url();
trackback_url_list();
got_url_rewrite();
esc_url_raw();
wp_customize_url();
get_post_embed_url();
get_header_video_url();
get_oembed_endpoint_url();
get_privacy_policy_url();
wp_admin_canonical_url();
wp_privacy_exports_url();
wp_get_update_php_url();
wp_get_default_update_php_url();
wp_get_direct_php_update_url();
π§ URL Processing Functions
parse_url();
wp_parse_url();
download_url();
esc_url();
get_url_in_content();
attachment_url_to_postid();
set_url_scheme();
wp_guess_url();
wp_nonce_url();
get_blog_id_from_url();
get_oembed_response_data_for_url();
π REST API Related
rest_url($path, $scheme);
rest_api_url($path, $scheme);
get_rest_url($blog_id, $path, $scheme);
rest_route_url($route, $scheme);
rest_namespace_url($namespace, $scheme);
rest_endpoint_url($endpoint, $scheme);
rest_link($rel, $url, $title);
rest_get_avatar_urls();
π WooCommerce URL Functions
wc_get_cart_url();
wc_get_checkout_url();
wc_get_page_permalink( 'shop' );
wc_get_page_permalink( 'myaccount' );
wc_get_account_endpoint_url( 'edit-address' );
wc_get_account_endpoint_url( 'edit-account' );
wc_get_account_endpoint_url( 'payment-methods' );
wc_get_account_endpoint_url( 'lost-password' );
wc_get_account_endpoint_url( 'customer-logout' );
wc_get_account_endpoint_url( 'dashboard' );
wc_get_endpoint_url( 'order-received', $order_id, wc_get_checkout_url() );
get_term_link( 'tables', 'product_cat' );
get_term_link( 'mixed', 'product_tag' );
Notes
- This list includes functions available in core WordPress and WooCommerce as of August 2024.
- Some functions may be added in future WordPress releases or by third-party plugins/themes.
- If you need a URL that isn’t listed here, consider checking the official WordPress Developer Reference or browsing the source code.
- Avoid reinventing the wheelβcustom URL functions should only be written when necessary.