The same way you would any other:
foo();
Active plugins are loaded before the theme files
You may want to check that your plugin is activated and the function is available so things dont go pear-shaped if you forget to activate it, like:
if(function_exists('foo')){
foo();
} else {
echo "oh dear you haven't activated/installed 'myplugin', go do that before the 'foo' feature is available";
}
Also keep in mind foo
is a very generic function name, perhaps the “omgfoo” plugin also has a foo
function. So prefix/namespace your function to something unique
You will eventually want to use actions and filters, as they’re safer and better practice, you can continue to read up on that here
Related Posts:
- Rewriting every url
- Passing URL parameters to WordPress pages and pretty url
- Publish Post After Click On A Link
- How to get the custom page get_permalink?
- Custom url structure for custom template
- Add a Custom Permalink option in the Permalink Admin Screen?
- How to get the permalink of a page when loading my plugin
- How do I add a custom sub menu menu under Woo-commerce marketing?
- How to change custom post type pemalink Hierarcy
- Modifying Author Link to add Author Meta in URL
- Perform internal redirect in WordPress?
- How to get the permanent link in a plugin?
- flush_rewrite_rules() not working with update_option_{$option}
- Add_rewrite_endpoint doesn’t work with post name permalink structure
- How to embed a new string in url?
- Make get_permalink() work outside the Loop using filters
- help intercepting save_post through plugin
- WordPress Frontend Page using Plugin
- Child theme modifications not showing up
- Create new page in wordpress plugin which doesn’t exist
- Getting Fatal error: Uncaught Error: Call to undefined function plugin_dir_path() when linking to another file within my wordpress plugin
- Changing author slug for a custom role without using plugin
- Custom author page for custom role
- Custom role not listed
- Is it possible to change plugin’s Admin Panel Url?
- Coming soon pages with rest of site in maintenance mode
- claim a permalink and all sublinks in plugin
- Page Templates from plugin not working after upgrading WP to 4.7 or upper version
- How to add option box in “Edit Post” plugin API?
- Avoiding plugin name collisions with WP updater
- Using standard backend elements in Plugin
- Plugin development: how to create a form and get custom data?
- Security error WP 4.0 + WP phpBB Bridge [closed]
- How to make my plugin theme-independent?
- Execute a function using ajax
- Updating post meta for custom post types
- Custom Shipping method not showing in checkout
- REST-API: extend media-endpoint
- How can I create a simple interface for my WP plugin?
- Where to put my global functions?
- Hidden Custom Post Type
- Where does WordPress register default scripts like jQuery?
- Rewrite url without flushing the database?
- Adding Attachment Display Settings in custom media frame
- How to include code into functions.php file via a plugin
- Is it possible to enqueue CSS files from plugin before theme’s CSS files?
- Determine Registered Admin Menus
- Help With MySQL to WPDB Query Conversion
- code is working properly in Core PHP but writing coding in WordPress
- 306 MB of wp_options occupied by WordPress SEO Plugin, is that normal? [closed]
- Custom plugin init action causing general slowness
- Duplicate results are displayed in a custom plugin [closed]
- Disable Individual Plugins (specifically in Custom Post Types) on a per-post basis?
- Best/Correct way to add an option to a category
- Basic question about accessing scripts in my plugin
- Automatically download, install and activate plugins that my plugin depends, how?
- How to create WordPress custom end point with multiple parameters?
- I receive taxonomy id
- Loop in elementor custom widget not working
- WordPress SVN UTF-8 issue
- Asynchronous request in wordpress
- How to access OOP plugin function inside themes or other plugin
- change or add css to theme from plugin
- Displaying data from another database
- Every time I de-activate a custom plugin, the site encounters a critical error
- Custom Fields for Page Edits
- How do I remove all traces of a plugin?
- Is it possible/advisable to set last stable version to previous version?
- How to make sure settings are not lost when plugin is updated?
- How Can i import plugin option?
- How to override any plugin file in the child theme
- How can replace this url
- How to overwrite a plugin?
- How can I translate something in my class constructor of my plugin in WordPress?
- Define global variable in theme file and call that variable in plugin file
- SimpleXML is not working with xml response from external api
- Custom Plugin Update
- How do I stop plugins and themes from getting updated in a new plugin?
- How come W3TC is allowed to host premium code in the WordPress repo?
- Custom wp_list_tables redirect on specfic page
- Passing function into add_action always returns the first argument
- Hook to display element as product on category page
- Members-only page, but accessible via sharable link
- I can’t use WP_Query
- plugin not hooking to my custom hook
- Populate select option with JSON file
- Enahanced search for edit.php and custom post type
- WP Plugin: Print javascript in header
- API Functions to Register and Show WordPress List Tables
- How to save default values into an option and delete those upon actvation and deactivation in wordpress?
- How to Add Jquery FullCalendar in wp plugin in admin
- Ajax, jQuery and WordPress
- Add custom fields in the new and edit the site forms without touching the WP core
- Extend WordPress REST API with Scheme Pro Plugin
- How to submit the custom form data in database in WordPress without plugin?
- Unable to show 4 products in a row
- WordPress check box unchecked on null value ternary operator [plugin development]
- Why haven’t I see plugins using get_file_data to handle retrieving plugin version?
- How can I make my plugin detect if a certain theme is active?
- Pulsing circle before the post title (Breaking news flash)