Most of this code is unnecessary. You’re attempting to convert a URL to a path when you could just use the function that returns a path.
$path = get_theme_file_path( 'archive.php' );
if ( file_exists( $path ) ) {
echo 'File Found: '. $path;
} else {
echo 'File Not Found: '. $path;
}
Related Posts:
- ajaxurl not defined on front end
- How to include jQuery and JavaScript files correctly?
- How can I configure Docker for developing and deploying a custom theme?
- Where to store PHP files created by plugin / themes
- How to post data to same page in wordpress
- Understanding WordPress functions’ naming conventions
- Is there widely accepted phpDoc syntax for documenting which hook calls a function?
- How do I Make a Theme “plugin-ready”?
- How to Add a .js file Only in one specific Page Dynamically to Head
- Show a user their recently viewed posts
- Escaping built-in WP function return strings
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- Add new user and add meta at once
- Custom user profile, registration, login page with theme
- $wp_filesystem returns NULL. What are the dependencies?
- How to Display Custom Post Type’s Gallery (images ) in Through WP_Query
- Customizer Not Saving Options
- What is better way to use Bootstrap inside admin panel?
- Error : “Updating failed: The response is not a valid JSON response” with custom shortcode
- What’s the better way to add an inline script?
- Backslashes being stripped from CSS
- What for the tables ending with the meta used in database of wordpress?
- Finding the paragraphs in content
- Is Dreamweaver CS5 a serious choice for theme/plugin development?
- What allows a template file from plugin to be copied in child theme and overridden?
- How to avoid loading same script twice?
- Can I individually style items in the backend widget list?
- WordPress security issue to output data from user input from theme option form
- WP_Query returns no results
- Finding posts containing matching array elements in a meta field usign WP_Query
- Customizer: widget-synced triggers twice
- How to Create Custom HTML Tag on Editor in `Text(HTML)` mode
- Is It Always a Best Practice to Decouple the Frontend from the Admin Area When Developing a WordPress Application?
- Beginner advice
- Change the ‘published on’ text?
- How to render a time-of-day string like ’16:42′ with a site’s chosen time format?
- How to filter users list on user_status field with get_users()
- Can Page Templates be Applied to Archive and Post Templates?
- Is there some way to provide the user a list of existing content in a CPT
- Change the look and feel of admin pages
- How to access noticeOperations from withNotices
- How to get boolean value from register_meta properly?
- Form doesnt save to database
- Notice: Trying to get property ‘term_id’ of non-object
- What is the proper method of using global $post?
- How to export post meta with images in wordpress
- Password field is empty when using wp_signon();
- How to change title tag at page after loaded post?
- Strange Situation When Try To Retrieve Github Gist Using wp_remote_get
- WordPress custom taxonomy check box to dropdown
- Warning: include(): https:// wrapper is disabled in the server configuration by allow_url_include=0
- Plugin is not generating title tags on any pages or posts
- Is it necessary to do validation again when retrieving data from database?
- Make a plugin page out of influence of the theme’s style
- Update Data parameter of a wp_localize_script() call
- get_the_tags with separator control?
- 400 Bad Request, in wordpress theme development, wp_ajax
- Add child pages to submenu automatically
- Why in this archive page that call query_posts() function show only the last 10 posts?
- Why would you use esc_attr() on internal functions?
- Invalid hook call on save, not edit when using swiper slider
- How to find where an object first instantiatiation
- Full documentation about $args for register_rest_route?
- Using HTML links within translatable string
- How to get terms for taxonomy
- How to remove/replace current page template?
- WordPress dynamic widget by location?
- Adjust query on single
- Using password protection to load different page elements?
- Anyone using unzip_file successfully? It uploads the zip but doesn’t extract it!
- WP_Query order posts by category
- WordPress Favicon not Working For Images/Videos/PDFs
- Can’t upload image via submitting custom post from frontend
- Need Help to make a logic for editing posts in Frontend
- How can we stop showing short code in create or edit post section
- Is it possible to develop themes and plugins locally while still allowing content to be updated directly in the admin dashboard?
- Why is that only the first row getting inserted into Mysql table when i import csv file on backend custom plugin?
- Error Connecting to Database WHEN Installing WordPress on XAMPP [Tried All the Usual Stuff] (Pics Included)
- WordPress Filesystem create CSS-File – get Shortcode ID for Name
- How can I measure CPU and RAM used by my theme or plugin
- set a custom post type to a taxonomy term programmatically in metabox
- Custom premium registration form and profile page for a WordPress Web Application
- My enqueue admin style function doesn’t work because of ?=ver
- How to destroy or dispose wordpress uploder/manager?
- To remove rendering of menus and header, plugin or theme?
- To remove rendering of menus and header, plugin or theme?
- How can I add recent posts to menu like mashable
- Is there a general way to get a themes primary colour?
- How to Register/Link to .js Files in WordPress Dynamicaly in Header.php
- Display Data’s metabox in page
- Ajax functions – no access to wp-admin.php only online
- How can I make my website with wordpress having on-spot editing feature as compared to concrete5 CMS?
- Best Way to Inventory the Media Library of a 200+ Multisite Installation?
- Loading jQuery library from WordPress admin
- Using tag or inline style attribute?
- how to insert content into wp_head after loop_end
- How react js and other Javascript Technologies works on WordPress plugin?
- How to create A – Z List with pictures?
- Remove Gutenberg Buttons Block
- User set default settings for a Block in Site Editor