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
- Hide prices and checkout functionality in woocommerce
- How do I exclude plugins from getting automatically updated?
- Plugin update error message
- How to handel multiple checkbox field in the admin settings page with Settings API
- wp_insert_user – how to send verification email before logging in
- Is the WordPress HTTPS Plugin Still Safe To Use? [closed]
- Set a User as Author of all ‘New Posts’ posted
- How do you auto-activate plugins from child themes
- What is the function to get plugin base url in multisite?
- Code in theme functions.php faster than with a plugin?
- Trying to count the total number of paragraphs inside a blog article
- WordPress 5 upgrade: until when is it safe to keep project running in 4.x?
- How to get post URL in the_content filter?
- Installing WordPress only for a separate page – ‘mydomain.com/blog’
- ‘Customize’ button in admin bar for CSS
- Inserting HTML tag with ACF into shortcode
- Reduce Drop down Menu Width in WordPress
- How to Display a Plugin function (content) on frontpage using index.php
- Classified ad website : which solutions to use? [closed]
- How to create an input field, and base the output on spreadsheet data? [closed]
- posts comments goes to trash
- Customize permalink wordpress category id
- Admin style for just one plugin in dashboard
- What will happen if i deactivate my visual composer plug in? [closed]
- Finding the URL to be used to check if plugin is installed with a theme
- How to create an option page for this simple plugin
- What is @Action in WordPress?
- the_tags : can we insert a class
- using do_shortcode
- WordPress checkbox and Illegal string offset
- How to load different homepage on Mobile.?
- How to activate a plugin on the activation of a theme?
- JQuery prepend a function
- Send email with list of active plugins upon activation/deactivation
- Where Should i write the code for wordpress ajax voting?
- How do I convert my WordPress website to be domain agnostic?
- Add the_post_thumbnail_url to a shortcode in function.php
- Show media-uploads to all users
- Cannot add edit themes and add plugins after multisite update
- how can authors to define custom pages?
- Adding a Tag Parameter / Filter to My Shortcode
- How do I create pages within a WordPress post?
- 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
- Alternative Hook to the_content for Changing Background Color
- Unpublished Pages Failing To Appear On Custom Path
- 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?
- Add external javascript to post template
- Set up new WordPress domain using unclear files
- Genesis Child Theme – Customize body
- Unable to activate themes on localhost
- 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
- why my wordpress dont have toolbar like, plugin, themes and other?
- 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
- Theme styling for plugins
- jquery-issue: cannot load the basic jquery
- 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?
- How to declare this function correctly?
- 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]
- Am having issues intergrating this api into my wordpress site, any help please?
- Make plugin admin page visible to other roles
- wp_enqueue_script doesn’t load JS in plugin
- Prevent primary navigational menu from expanding during page load (WordPress / Astra Theme)
- Read page- or post-content across different builder-plugins
- Remove posts that start with similar words (like a delete duplicate posts plugin)