If it is a custom theme for your site then there would no great speed or security improvements by moving functions.
On the other hand if you want to distribute the theme then I recommend having only the minimum php in the page templates files and having the rest of the functions organized in different files. I like the basic theme set up files of the theme to be in the functions.php and the rest in separate organized files. _s does a good job of this. The reason for moving the functions away from the templates files is that it makes it easier to customize and manage. If you need to duplicate a template then you do not end up duplicating functionality.
I would even place the non-presentational functions in a plugin for easy deactivation and management. See this answer for more information.
Related Posts:
- When to check if a function exists
- Maximum lifetime for nonce
- Create a free scripts and styles template within a plugin
- How can I turn a custom wordpress page into a product page?
- How to modify files inside wp-includes directory in wordpress
- Customise Grouped Product display in Woocommerce with custom column
- Does hooking into a plugin action / filter override the plugin’s function for that hook?
- Add function to Dokan ajax class
- Template file structure , wordpress hook for altering the template
- Dynamic banner for use on external sites
- How to include PHP files in plugins the correct way
- How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?
- Is it ever okay to include inline CSS in plugins?
- Why does WordPress add 0 (zero) to an Ajax response?
- Passing arguments to a admin menu page callback?
- How can I configure Docker for developing and deploying a custom theme?
- function deactivate_plugins does not exist
- Understanding WordPress functions’ naming conventions
- How to control output of custom post type without modifying theme?
- Allowing for multiple template views on the Gallery Settings page when using the Visual Editor
- Using Primary Color in Plugin Block
- How can I change the frequency of a scheduled event?
- How to customize search result page title?
- Determine which theme location a wp_get_nav_menu_items is for
- Checking for existence of a page by title?
- Problems with removing admin bar
- How to use wp_set_password in a plugin?
- Check if I am in the Admin Panel (wp-admin)?
- How to check active theme is parent or child wordpress
- Does add_filter work outside functions.php
- What function to hook for changes made in status and visibility of a post
- Delete a specific item menu when I deactivate my plugin
- Is there a way to loop through a shortcode datasource to create a table?
- Plugin Uninstall and Deactivate via Options Menu
- Order properties should not be accessed directly
- add more custom post types and custom role to the code
- Executing a function upon webhook calling wordpress
- Enqueue scripts in footer
- Retrieve contents/page names of various pages for use in a plugin
- how to use hook deleted_user into custom function to delete user from custom table
- Can wp_list_comments output into variable?
- is user logged in not working
- Where to store the name of a custom table?
- ServerSideRender and Media Object: attributes passing image data object to php renderer even though it’s not set
- Override class inside $atts shortcode_atts in WordPress
- Can Page Templates be Applied to Archive and Post Templates?
- Clearing caches on plugin uninstall
- How to use a hook to override an update_post_meta call in a plugin?
- correct way to call javascript into hook function
- how to search users by ajax live search
- Remove unwanted elements for a wp_nav_menu
- How to add user details to different tables immediately after user registration
- How to make “upgrade safe” theme for a plugin?
- Fatal error: Call to a member function get_page_permastruct() on a non-object
- wp_get_post_terms Order by not working
- What action hook can I use to add a JavaScript to a page post using a theme template that is not including get_header() nor get_footer()?
- Function/Class to list categories with checkboxes
- What exactly do this function declared into functions.php file of a WP theme?
- How to set a cookie for logged in users to md5($user->ID . “my_secret”)?
- Why wp_die() doesn’t work with wp_redirect but exit() works
- Alternative functions for mysql_free_result and mysql_ping in wordpress functions
- Create Widget or Enable Shortcodes in Sidebar
- Apply styles to blockquote element with the WYSIWYG editor
- How to change WooCommerce loop product title HTML output in single product page and archive page
- Plugin custom post template; without overriding all posts
- How to output functions from plugin inside theme
- How to use a WP_Customize_Control outside of the Customizer?
- Overwriting a plugin function
- Writing editor content to a file
- Adding tables to dashboard pages programmatically?
- can’t access some WordPress function from my plugin
- Custom Settings Plugin Save foreach checkboxes
- Custom Endpoint – Does it possible to use PUT method with WP API Rest?
- Why won’t this submenu page show? – My First WordPress Plugin
- Can someone explain what’s the use of parse request function in WordPress?
- function add custom fields to media gallery
- Override category archive page title (not the head title)
- Make visible page only in the trash
- Rate limiting ajax requests in WordPress
- Overriding the template files using a plugin for all themes
- How to prevent users from deleting their accounts?
- WordPress plugin how to run function when button is clicked
- Hiding class namespace from plugin’s extensions
- Determine if the current page, is being edited
- WordPress delete mysql rows with string
- Use a page as a template for a custom post type
- Page template compatibility with different themes
- Associating special meaning with user id 0
- WordPress permalink setting
- Theming Custom Plugin Page
- Adding class to the parent of current-post-ancestor / current-menu-parent / current-post-parent
- show Visual form builder in the front end
- How do I store a custom dataset in WordPress to best take advantage of API?
- How can i call from custom fields to the category editor?
- Why does this fail: Disabling plugins enqueue_script() in functions.php
- Is Explicit Versioning a better alternative to Semantic Versioning for wordpress?
- Custom plugin not appearing
- get_term_by() returning null on plugin
- Is there any other ways to replicating changes on live from staging without pushing from git
- How to make a Template page to show the information of different things Shop and Product page?