You can only declare a function once.
My reccomendation is that you put the functions in the plugin, then use filters to override in the theme, e.g.
In the plugins:
function my_awesome_function() {
return apply_filters( 'my_awesome_function', "plugin" );
}
In your theme:
add_filter( 'my_awesome_function', function( $value ) {
return "theme";
} );
Now every call to my_awesome_function();
will return “theme” not “plugin”
Related Posts:
- Need to replace Currency Shortforms
- How to Overwrite validate_plugin function
- wordpress Search function is not working
- Where do I put the code snippets I found here or somewhere else on the web?
- Disable plugin / plugin action via theme
- How to remove WPML Generator Meta Tag by theme’s functions.php (override plugin function)? [closed]
- Need to create a Theme demo site that features multiple themes
- Why does including a file in theme’s functions.php not work?
- Adding New Role
- Change destination author link
- How to call a plugin function in footer.php
- Add Top-Level Menu that opens URL
- wordpress custom login successful redirect hook
- WordPress ajax call for not logged in users, doesn’t work
- Over write plugin templates
- Display All Non-Used Plugins
- Override plugin functions in functions.php
- Using has_filter with a class based plugin to check whether the plugin is active or not
- New Plugin: Post update pushes a copy as a revision
- Placement of Code in Plugin for hooking `save_post`
- ajax front-end increment views on click
- Display a text message if the field is not found and not if found
- Add get_option to jquery
- Scope for PHP Variables Assigned in functions.php or a plugin
- Override the filter from plugin in child theme
- Add a plugin before main container
- Avoiding Duplicate function names in Post Loop (WP_Footer script)
- How does WordPress process plugin installations?
- How to create TEMPORARY Download links in a wordpress POST?
- Conditionally add apt. Open Graph meta data to different pages on WordPress site
- 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
- wordpress plugin is not activating from widget
- How to change constants in WordPress wp-config.php programmatically?
- How to use a class from another plugin
- Override Plugin Script Fucnction in WordPress
- How to call WordPress function other files
- How to remove custom post type and add category and post name
- Ajax : Call undefined function plugin_function() … can’t call any plugin function
- bbPress plugin: forum lists not showing in correct order? [closed]
- What is @Action in WordPress?
- Is there a best practice remediation for PhpStorm’s warning that void function the_post_thumbnail is used?
- How to over-ride a file in a plugin? [closed]
- Overwrite category head title
- execute function after one completed
- WordPress checkbox and Illegal string offset
- Undefined index: action plugin problem
- PHP script from functions php is loaded via admin-ajax to div…and the result is 0, not the desired content
- How to reset the plugins without deactivate the plugin
- plugins_url() works everywhere but wp_reqister_script()
- Replacing global wp_query
- wp_enqueue_scripts
- How to get specific string/value from an array? php [closed]
- WordPress Stock Update Programatically
- 5 PHP Fatal error: Uncaught ArgumentCountError (Cannot Find)
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- same user role or copy the user role to be same as the other role
- Changing plugin options from theme functions file?
- Expected ‘add_filter’ (T_STRING)
- Execute a function when the entire page is displayed
- How can i listing current category and Featured Category post list?
- How to add custom function to pluggable.php
- Adding a pagenavi to function for displaying bookmarks
- grab or load text on demand
- sliding/fading header plugin or approach suggestion
- What is the most efficient way of adding additional functionaliy for admin only
- Error Metabox Warning: call_user_func() expects parameter 1 to be a valid callback
- Replace the_content with ACF Flexible Content via function
- How would I get the new plugin version on this function?
- Cannot pass value variable to WP AJAX functions
- Search in WordPress
- Easiest way to load/fire a handful of functions, IF checkbox is checked?
- post id or permalink auto-incrementing number and reset everyday
- Modify function output in a plugin
- Is admin section completely customizable in terms of styling?
- How to make the first letter of a post title uppercase, in a plugin?
- Get a Taxonomy values in an array
- Migrating custom php we wrote from functions.php into a site-specific plugin
- Shows warning when enable “wp_gallery_custom_links” plugin with Themify Builder
- WordPress environment not loading properly
- Place content inside the Post Loop
- Follow author on muti-user WordPress site
- Code fails in plugin file but works in functions.php
- Conditional required fields for WordPress Contact Form 7
- Cannot access variables within a widget
- Is there any wordpress function to update a random post every 10 minutes?
- Calling a function from a link in WordPress
- WordPress plugin options need to delete after deactivate & uninstall
- WordPress function to add text
- Saving an array to get_options
- Doing action based on input from options menu
- Showing author box on post detail page
- is_plugin_active() not defined on active plugin, in the thumbnails.php file
- Sync roles across several plugins
- Requires PHP version 5.3.0
- filter just a portion of plugin function
- Make plugin admin page visible to other roles
- Sort posts by Date (DESC) and by ACF: active_inactive (ASC)
- wp_enqueue_script doesn’t load JS in plugin