The active theme’s functions.php is included on the backend because a theme can be configurable from the backend.
If your theme depends on the functions of a plug-in being available, then you must either make sure the plug-in is always available or make your theme robust enough to handle situations where it isn’t.
You could put all of your theme’s functions that need the plug-in’s functions into a separate php file that is only included when the plug-in is active. This would make it easier for you to deactivate the plug-in for short periods while you make other updates.
So in your theme’s functions.php you could add:
if (function_exists('plugin-function-name'))
{
include 'path/to/functions-that-need-the-plugin.php';
}
Then you only have check if function exists once, and the theme and backend will still function when the plugin is not available.
Related Posts:
- Disable plugin / plugin action via theme
- Shared functionality in plugins and themes
- Need to create a Theme demo site that features multiple themes
- Declare a function before plugin does on the theme functions.php file
- Override the core function locate_template
- Set WordPress Featured Image For All Post Slugs Matching Image File Name in Specified Directory
- Fatal error: Call to undefined function cmsms_theme_page_layout_scheme()
- All sites themes functions.php have been changed
- Overwrite category head title
- How to make a dynamic css class whose name changes every visit to confuse scraper
- Removing the custom_image_header from wp_head
- What is the most efficient way of adding additional functionaliy for admin only
- Hide Plugin Custom Post Type Menu Link
- Securing langugae folder
- How can I make the search bar in my wordpress site search all of the pages rather than just the blog posts?
- Shows warning when enable “wp_gallery_custom_links” plugin with Themify Builder
- How can I add a custom checkbox / radio button on the admin theme options to display a CSS or other?
- How to Call Function From Separate WordPress Install on Same Server?
- pluggable function in theme, to be overridden by plugin
- Can’t get custom user meta to show in header
- What Are Security Best Practices for WordPress Plugins and Themes? [closed]
- How to include a plugin’s php file to another plugin functions file [duplicate]
- Disable author pages for specific users
- Set active theme via URL
- How to assign user a role if none is present when logging in
- Migrating a File from Plugin to Theme and changing its path → instead create a REST endpoint
- How to find out what blocks are added by a plugin
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- Unable to install theme recommended plugins on Multisite
- More than one text-domain is being used because of the included templates for plugins
- How to prevent users to download videos from lms website?
- Dropdown menu on custom page with product to choose number of products per page
- How to append to title via functions.php for auto-posting plugin [duplicate]
- Bootstrap Drop Down menu is not working
- How to change constants in WordPress wp-config.php programmatically?
- Override Plugin Script Fucnction in WordPress
- Child Pages Short Code plug-in and hover capabilities?
- How to call WordPress function other files
- Conditional attributes and logic per product category
- What is @Action in WordPress?
- Where are theme codes located for WordPress?
- using do_shortcode
- WordPress checkbox and Illegal string offset
- How to get menu location in wp_update_nav_menu hook
- How to activate a plugin on the activation of a theme?
- How do I add a plugin dependency to my customized theme?
- Using custom fields for image alt and title
- Where Should i write the code for wordpress ajax voting?
- Set up functions to be overridden without using function_exists() by short-circuiting them?
- How do I convert my WordPress website to be domain agnostic?
- Add the_post_thumbnail_url to a shortcode in function.php
- Add action to custom Function
- Show media-uploads to all users
- Cannot add edit themes and add plugins after multisite update
- Remove updates text on plugin or themes list page
- how can authors to define custom pages?
- Adding a Tag Parameter / Filter to My Shortcode
- How to prevent plugin, theme installation failures on WordPress?
- Edit all $wp_scripts at once to $in_footer = false
- How to upload large media file in chunks, without any plugin?
- WP Function does not trigger on Webhook API Call
- Why do I need to reload the page for WordPress to see the new custom field added with jQuery
- Cookie value changes back to previous value after changing
- RSS Feed on WordPress showing code (hypertext) in articles titles
- Remove a div class with condition
- How Can I Increase Breadcrumb Position Count (Starting From 2)?
- Main content of site not showing, but does show when logged in to wp-admin
- How to add specific script to WordPress webpage that will working with user input and databases
- How to create algorithm for ordering posts in WordPress?
- Hooking into the HTML header container
- Add external javascript to post template
- Set up new WordPress domain using unclear files
- Plugin function in child theme
- How to roll back WordPress version or prevent migration from forcing update?
- Multisite converted to Single Site can’t add new plugins or new themes
- Update (a function) post’s featured image as soon as $image_url changes
- How to link file or image from wordpress plugin dir to theme by using themes function.php, is it possible?
- Using activated_plugin to run code
- Why isn’t my plugin seeing other classes?
- Theme styling for plugins
- Creating themes using the one Plugin (Toolkit)
- jquery-issue: cannot load the basic jquery
- Template from scratch: Sidebars not showing widget
- Contact Form 7: custom validation [closed]
- functions.php conditional output for a single plugin
- Single dash converted to double dash
- How use Dynamic hyperlink on each wordpress post?
- Why do I get this “peer’s certificate issuer not recognised” error when trying to install a theme?
- Site is setup statically – how to make it content managable?
- Javascript as Jquery Function Call?
- Can’t modify plugin function
- Any plugin/theme available which suits my requirement? [closed]
- Two sites one PC
- PHP if url extension action=discussion condition use [closed]
- Elementor with system colors instead of kit colors [closed]
- How to Allow Users to Select Recipients In a WordPress Comment section?
- How often should I execute add_filter and function declaration in Code Snippets?
- Product customizing quiz – quiz adding products to the cart
- How to change all the urls of the WordPress site?
- I want to allow certain file types on dokan upload files