This could be the matter of adjusting the priority of your filter callback,
since the plugins files are executed before the functions.php
theme file. That could explain why it works in your functions.php
file, if the priority is the same.
When you add the code snippet to a plugin, it might be executed before the other plugins that use the same filter.
The default priority is 10
, so you should try something higher in your plugin code, for example:
add_filter( 'user_contactmethods', 'newfields', 99 );
or even
add_filter( 'user_contactmethods', 'newfields', PHP_INT_MAX );
if you want to be absolutely sure your filter callback is the last one to be executed – assuming the other plugins are not using PHP_INT_MAX
as well.
But better yet, just check the priority the user_contactmethods
filter callbacks the other plugins are using.
Related Posts:
- Keep one user logged for a year?
- WP Job Manager Category Drop-down; Change Placeholder Text Via Filter
- Pass info from functions.php to plugin
- add_query_arg not working
- How to append to title via functions.php for auto-posting plugin [duplicate]
- Redirect to another page using contact form 7? [closed]
- Check if variable is set in filter
- Passing stored variables to add_filter
- Hook for altering the content of all wp mails
- How to convert Currency from USD to other IP Based currency in Php function
- Unpublished Pages Failing To Appear On Custom Path
- How to Unhook actions/filters in within Class in plugin
- Plugin function in child theme
- Use action, filter, or hook to append HTML to WordPress plugin function
- Modify function output in a plugin
- Override filter variable not working
- Update User Meta Via Ajax
- WordPress Add advertising ads befor and after content with periority [closed]
- Every time I use wp_get_current_user() my plugin breaks
- making a glossary with wordpress
- add query string to all pages after user logged in
- WP Members additional fields on user profile [closed]
- How to Add Extra Text In WordPress Title Before Post Publish
- How often should I execute add_filter and function declaration in Code Snippets?
- filter just a portion of plugin function
- Possible to overwrite load_template function in plugin using functions.php
- plugin development: problem with functions
- Change permalink structure hidden button edit
- Shortcode button dosent work for all posts. Work for first post only
- How to keep users unique id stored in session in addition to IP in WordPress plugin?
- Is there a way I can find wordpress posts that don’t contain a word?
- Prevent shortcode from being wrapped in tags
- When to call add_filter
- AJAX button run function
- Dropdown menu on custom page with product to choose number of products per page
- How do action and filter hooks understand where to look for the core function that we hooked our function to them
- How to get current post user id
- Change wordpress current_time function to different timezone
- Inserting HTML tag with ACF into shortcode
- Executing my function once on a specific time
- How to stop or remove an action being called inside a function of an extended class
- Missing Argument
- load_plugin_textdomain error
- How to override a plugin function wrapped in a class?
- Bootstrap Drop Down menu is not working
- How to Display a Plugin function (content) on frontpage using index.php
- How to create user groups and allow custom posts and plugin modify/access to specific group?
- Edit default comments page in WP Admin
- New User Form – Custom Menu Page
- wordpress plugin is not activating from widget
- Inserting above the comment template
- WordPress Central User Database
- Theme my Login plugin, how to update fields
- Creating a plugin to sanitize comment and the url field before display only
- Edit Yoast SEO breadcrumbs output [closed]
- How to read individual user’s directory and display content to that specific user?
- Adding Shortcode to Text Widget
- Date calculations from 2 custom fields
- How to find the origin of a file upload from within wp_handle_upload?
- Snippets: is it better to add them in functions.php or make site-specific plugins?
- Does WordPress validate inputs to all functions? (such as get_user_meta and insert_user_meta)
- Custom random quote widget breaks when used in multiple sidebars
- Using a function to change favorites listing
- Modifying the comments section through a plugin regardless of theme
- Display post lists in 2nd paragraph
- wp_set_auth_cookie causes 403 error in the wooCommerce checkout
- How to debug error message: Cannot modify header information
- Using a post-signup hook to get user details
- How to enable specific plugin only based around shop manager role?
- How to change constants in WordPress wp-config.php programmatically?
- Restrict media upload size by format
- How to get the element ID from new menu list that added with add_filter()?
- How to use a class from another plugin
- Override Plugin Script Fucnction in WordPress
- How to make custom column Admin>Users sortable?
- How to display custom sidebar in wordpress 5.5.2
- Calling plugin function inside custom plugin for onclick event
- Show function to super admin
- White page by using filter template_include
- How to check current user before all actions and filters?
- How do I create a filter feature on WordPress? [closed]
- Filter out other users comments. Visualize only own comments and editor role users’ comments
- creating html reusable blocks via shortcodes
- get current date + 90 days and checking every day
- Create a navbar filter that filters by a custom field
- Passing an array from shortcode-function to filter-function
- Adding a new field to the address field type in gravity forms
- Replacing a plugin function with a custom renamed function doesn’t work
- Get Time Taken By Each Action Hook in WordPress
- How to create an input field, and base the output on spreadsheet data? [closed]
- Facebook Messager Plugin
- How can I copy all users to newly created site on a multisite network in WordPress?
- Nested shortcode functions accessing variable
- Filtering WooCommerce Orders by Category
- Calling an attribute from a plugin shortcode
- Fatal error: Call to undefined function cmsms_theme_page_layout_scheme()
- How to call WordPress function other files
- How to remove plugin metaboxes from edit.php
- How to create restrict content to users (by user, not by role)
- Plugin developer automated documentation