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
- Best way to initiate a class in a WP plugin?
- What Plugins Demonstrate Great WP Plugin Development? [closed]
- Why activate_plugin is not working in register_activation_hook
- Best Practice for Referencing the Plugin Directory
- Symlinked plugin directory doesn’t appear in Admin
- How can I limit functionality in one version of a plugin?
- How can I include a setting that has a variable number of values in a settings page using register_setting?
- Custom data-id wp_enqueue_script
- How use %like% in sql statement wordpress
- Can I use a form in a dashboard widget?
- Is there a way to alter the order in which the plugins appear in the page?
- Retrieving plugin options value saved through setting
- How to ‘clone’ a wp plugin to make small changes
- MITM risk of not sanitizing?
- Get IDs of Images from Gallery Block in InnerBlocks of a Custom Gutenberg Block
- Change plugin main file name (that is currently in the repo)
- resetting permalinks after changing page names
- Edit Yoast SEO breadcrumbs output [closed]
- Enqueue WordPress plugin scripts below all other JS
- Is there any kind of theme on WordPress to sell my own movies?
- Redirecting thousands of posts that currently have no category in their permalink when changing permalink structure to include category
- Suggestions on Approach to New Plugin I’m Stuck On
- How to redirect users to their profile after they successfully edit their profile
- Is it necessary to auto delete my WP plugin database tables when users deactivate/delete my plugin?
- Namespaced shortcode?
- How to pass variables to a function argument using add_action [duplicate]
- Activate my plugins via FTP
- Custom post types – remove default post supports through empty array?
- How to insert and call new data in wordpress website database through a plugin
- update_option_{$option} not showing old value
- How to be escape Variables and options when echo?
- Release the plugin in the WordPress repository where redux is used
- Dokan Marketplace store link in single product page
- A server-side hook failed when committing plugin code to SVN
- Development of plugins to add components like JqueryUI
- plugin enqueue style on all pages
- why the wp_register_script doesn’t work for register_activation_hook
- Use a custom block in another block
- Set Button in PluginDocumentSettingPanel Content (WordPress Gutenberg)
- GitHub plugins safe to use in my website?
- Personality quiz in wordpress using a plugin
- How can we get this dynamically as this folder may not be by the same name always → wp-admin
- Why is my shortcode not working?
- Link custom post type to page
- implement checkbox or toggle switch in plugin code
- wp_remote_post To external API multiple values with the same key
- wordpress form not saving or updating
- How to put a maximum real-time users limit
- added code to permalink (URL)
- Custom admin plugin read CSV
- Can we rename a plugin directory for a already launched plugin?
- How can I call functions from a custom plugin?
- How to get short description under heading – Visual Composer [closed]
- plugin installing error
- Why the output of an image gallery plugin is not displayed into a page of my custom theme?
- Am I correctly adding styles to plugin?
- How can I insert a record into a custom table from my custom form in my custom admin page?
- how to create table during plugin installation in side a class
- WP_Filesystem usage within a block of code
- Why function hooked using object are executing at all time?
- How can I use multi Media Uploader in a plugin?
- Gutenberg: Dynamic Block – Show saved data in the editor
- How to fix ‘Call to undefined function do_settings()’ error?
- How do I set register_meta for a specific CPT?
- How to Enfroce Domain Licensing Limits? [closed]
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Update Content for a Custom Block Toolbar Button
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Wrong block appender button showing
- Uncaught Error: Cannot use object of type stdClass while showing the list using WP_List_Table
- Submitting form to admin-post.php WordPress
- WordPress Throwing Deprecated Errors on its own Files
- Need to add custom cart item data