The URL is the public web address. It is not related to the local file system. So what you need it a reference to the file system, not to the URL.
// path in relation to document root
include $_SERVER['DOCUMENT_ROOT'] . '/extras/file.php';
Or
// path in relation to current position
include dirname( __FILE__ ) . '/extras/file.php';
Related Posts:
- Include WP_Query in my own PHP file?
- Include a external PHP file into a WordPress Custom Template
- Include files in functions.php
- load/require specific php files for specific pages/templates/post types
- ob_get_clean returns empty string, ob_get_flush outputs string
- Filter the blog title displayed in the header
- How to check from which page the user is coming to the current page?
- where to include a php file
- Include Class File in WordPress
- nowplaying.include.php Will Not Display Results
- integrating external php library into wordpress- the right way
- Change title and meta description in included page (not template)
- Can I change a variable in a content part while calling it?
- the_author() not working outside the loop
- php syntax – how to concatenate properly – echo bloginfo(‘stylesheet_directory)
- How do I use the Simple HTML DOM Parser in plugin when other plugin already uses it?
- Put CSS inside a PHP file and include it the right way
- functions.php is being included twice, creating PHP fatal errors
- Adding subdomain to home_url for “add_menu_page”
- Custom theme: Alternatives to long list of ‘include’ in functions.php
- PHP help get_template_directory + PHP include
- code is skipping a div
- Change “en-US” to “en”
- Why does abstracting html from plugin code result in loss of access to wordpress functions?
- PHP include is only working in certain places in my custom WP theme
- Correct and safe way to include php content in my page
- What is the proper way to include a PHP framework into my theme?
- php include not working in custom page
- Post’s ID pattern?
- Using WP functions such as the_title() in an included php file
- What’s the best way to include PHP code in pages?
- How to include custom PHP file both in header and footer files
- Split site title and apply different classes
- Using bloginfo and divs inside a php file
- Include a file that has a function in it
- How to set base url for php widget
- CSS images don’t show up with bloginfo
- How do I call an external php non WordPress class into functions.php?
- require get_template_directory() . ‘path/to-my/file.php’ BREAKS customize > themes functionality
- I have a background-image in css file but don’t show in site.how to fix this prblm. i sent screenshot. thx
- Before & After Content – After Content directly below Before Content when using require_once
- loading a php file to a specific page id
- How do I fetch a data from an external database into my wordpress homepage
- How do I fetch a data from an external database into my wordpress homepage
- PHP get_category() function redeclared
- How do I / Is it possible to execute an external PHP file / function inside WordPress?
- Include a php file that is above WP installation hierarchically?
- WordPress blog set up
- Shortcode not passing variable to included file
- php “use” not working in template [closed]
- How to include a php file in every post and page [duplicate]
- Shortcode to include PHP file, pass various parameters to include?
- wordpress.org disallowing my plugin becuase of loading core files in cron cpanel file
- WPMU – How to echo only one URL
- Should I use include(_once) or require(_once) for loading php-file with customizer settings?
- User registration followed by automatic login
- wp_insert_user role not working
- How to paginate a list of custom taxonomy terms?
- reason of splitting theme files to multiple files
- Problem with Woocommerce REST API Authentication
- register_activation_hook isn’t adding table to DB
- how to get the value of time left for a transient
- is_page “range” for if statement?
- How to Fetch values from WP database based on selected option value by onchange using PHP?
- WordPress child theme fails to override parent navigation menu in /inc/structure/header.php
- Customizer: Output default value in Customizer CSS
- Adding rel tag to all external links
- 404 error when I acess the second page of post-type
- Where can I create a normal php file?
- Trying do build a contact form
- How to Disable WordPress Page Revisions?
- Prev/Next Links Broken on Static Front Page Pagination
- How to integrate noimage picture in this code
- How to add no follow to specific links?
- WordPress transient not working with WP Engine
- Basic wpdb update question
- Only show size attributes in product box woocommerce when available
- Can I set up a hover animation in CSS depending on a PHP conditional?
- Remove conditional tag from header
- WordPress upload file size error even after raising php limits
- Function for simple math doesn’t work what am I doing wrong? [closed]
- Disable Content Editor for Specific Pages
- How do I Populate a Table Field with User Meta Data?
- Redirecting visitor from foreign domain with WP content as referrer
- How do I select two meta_value by $ wpdb-> get_row mode?
- Exclude category from woocommerce product category list
- Send POST request to Flask app from functions.php file
- How to use a variable (for wordpress postid) in other queries?
- How to let mobile navigation menu close when link is clicked?
- How to transfer variables from one function to another [closed]
- wordpress method GET adress bar rewrite
- Show products per shortcode
- Update user_email via php – WP 4.7
- str_replace not preserving whitespace
- Add post class in custom loop (WP_QUERY)
- Unable to pass variable to database
- New to wordpress. Need Help with templates [closed]
- Issues trying to add a href statment with PHP into a PHP Echo Statement [closed]
- Help with if/else loop [closed]
- Pull latest Youtube Video from json url and make new post