Normally you never have to use your domain in your php code for plugins / themes. There are many functions like get_home_url()
which automatically fetches the domain from configuration and is also protocol agnostic if you don’t force a protocol via the third parameter $scheme
.
The function get_home_url()
internally uses is_ssl()
and the option value for home
to decide which protocol to use.
Related Posts:
- Is the WordPress HTTPS Plugin Still Safe To Use? [closed]
- While Using Static Pages, How Can I Get /blog into the URL of Each Post?
- Redirect to another page using contact form 7? [closed]
- Remove base from the custom post type URL [duplicate]
- How to change all the urls of the WordPress site?
- Best collection of code for your 'functions.php' file [closed]
- Between functions.php (theme), widgets, and plugins, which is loaded first?
- Where do I put the code snippets I found here or somewhere else on the web?
- Manually set global $post vars with an ID, in order to use template tags
- Disable plugin / plugin action via theme
- How do I call wp_get_current_user() in a plugin when plugins are loaded before pluggable.php?
- How do I replace a function, declared inside a plugin’s class, in functions.php?
- How to not allow users to create new tags, but allow to them to use existing ones
- How to export comments in WordPress?
- How to include a plugin’s php file to another plugin functions file [duplicate]
- How can I call a function from one plugin within another plugin?
- Shared functionality in plugins and themes
- Gutenberg disallow certain custom blocks but keep all core blocks?
- Remote upload file to server B
- Publish author posts only with editor approval?
- Replacing Icons in the Dashboard
- How can I make an Ajax login form work with FORCE_SSL_ADMIN enabled?
- Preserve custom URL parameter on more pages
- SSL redirect loop using WordPress HTTPS Plugin
- How to remove WPML Generator Meta Tag by theme’s functions.php (override plugin function)? [closed]
- Plugin update error message
- Limit access to posts/pages by user roles
- Using functions from a plugin in your theme
- Prevent publishing the post before setting a featured image?
- How to transfer a WordPress blog to a different domain?
- Keep one user logged for a year?
- Remove Google Fonts Which Are (Probably) Added By Plugins
- Customizing subject in comment notification e-mails
- if plugin is active? check if plugin is enabled or not?
- Common functionality between my own plugins
- WP showing “warning: call_user_func_array()”, What to do?
- Need to create a Theme demo site that features multiple themes
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- Define Function in functions.php or plugin and call in theme loop
- Autogenerate wordpress shortcodes using array?
- Which method is best to enqueue scripts
- How to Loop Plugin Option Field Set?
- How to make WordPress use protocol indepentent upload files?
- Can we completely remove the WordPress Sitemaps (WordPress 5.5)?
- Declare a function before plugin does on the theme functions.php file
- How to handel multiple checkbox field in the admin settings page with Settings API
- Why does including a file in theme’s functions.php not work?
- wp_insert_user – how to send verification email before logging in
- How to override a theme function (within a class) using a plugin
- Editor access to plugin settings
- WooCommerce create new product and add to cart on form submit
- Seeking clarification on page request life-cycle
- Generate Advanced Custom Fields box in custom admin menu page
- How to assign user a role if none is present when logging in
- Saving Plugin settings to the database
- Set a User as Author of all ‘New Posts’ posted
- Shortcode display outside the div
- Post source link plugin – small modification
- Adding New Role
- Change destination author link
- How to turn off email you receive when registered?
- Removing user contact methods works from functions.php but not from a plugin
- Execute a function using ajax
- Shortcode under a Shortcode Multiple times Possible?
- Custom Widget outputs the input but doesn’t save anything inside the textarea
- How do you auto-activate plugins from child themes
- How to call a plugin function in footer.php
- Woocommerce different URL for every table placed in the restaurant
- Add Top-Level Menu that opens URL
- Author Specific URL’s in WordPress
- How to load plugin before the wordpress jquery?
- How to remove action from plugin?
- Use functionality of 2 wordpress plugins
- What is the function to get plugin base url in multisite?
- Code in theme functions.php faster than with a plugin?
- Add query string to plugin URL
- Fatal error: Class not found in
- Disabling post images for not logged in users
- What’s the point of using WordPress’s built in admin-ajax.php?
- I need to generate the CSS for my plugin from a function, how do i map a request to a function in the front-end?
- wordpress custom login successful redirect hook
- How can i change an image’s author?
- Is revealing just the AUTH_KEY a security issue?
- Converting a simple plugin to be placed inside of functions.php
- WordPress ajax call for not logged in users, doesn’t work
- Extend Elementor Archive Posts widget with a custom skin in order to show multiple badges
- HELP: Integrating WP with raw PHP code once published button is hit
- Over write plugin templates
- How to find out what blocks are added by a plugin
- Display All Non-Used Plugins
- Override plugin functions in functions.php
- Override the core function locate_template
- How to redirect Old Post URL to new Post and keep Old post Comments?
- Can wp_script_is used in pluginA check if a script is being enqueued/registered from pluginB?
- Using has_filter with a class based plugin to check whether the plugin is active or not
- Modifying Footnote Plugin for Descriptive Title Attributes
- I would like to use create a function in my custom plugin to tell WP to use a different header
- New Plugin: Post update pushes a copy as a revision
- How can I pass a variable to a page with a SEF url?
- locate_template with multiple categories?