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
- How do I exclude plugins from getting automatically updated?
- How To Determine If A Filter Is Called In A Sidebar/Widget Context?
- Plugin update error message
- plugin_action_links Filter Hook Deprecated?
- Filter Hook on plugin update
- Is the WordPress HTTPS Plugin Still Safe To Use? [closed]
- Set a User as Author of all ‘New Posts’ posted
- Post source link plugin – small modification
- Failed to invoke other hook from the init hook
- Disabling post images for not logged in users
- There’s some way to add a wrapper around posted images?
- Extend Elementor Archive Posts widget with a custom skin in order to show multiple badges
- HELP: Integrating WP with raw PHP code once published button is hit
- Custom preview_post_link not working for draft post
- Modifying Footnote Plugin for Descriptive Title Attributes
- I would like to use create a function in my custom plugin to tell WP to use a different header
- How to show popup to a group of users?
- bulk change of image setting “link to” to “link to: image url “
- Limit the number of plugins that can be installed in a WordPress installation
- When to call add_filter
- How to stop or remove an action being called inside a function of an extended class
- Inserting above the comment template
- Date calculations from 2 custom fields
- How to debug error message: Cannot modify header information
- How to enable specific plugin only based around shop manager role?
- 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
- Adding a new field to the address field type in gravity forms
- Nested shortcode functions accessing variable
- Calling an attribute from a plugin shortcode
- qTranslate remove default directory from link
- Custom User meta field display
- URL parameters causing 404 on home page, but nowhere else
- Which filter affects the ‘entry-title’ post class
- How to set Noindex to all wordpress pages in a catergory?
- How to keep variable `$post` to using in another file
- Check filter defined or not?
- Plugin Development – Functions or Hooks?
- Editing wp-config.php
- wp_dequeue_script for a Plugin
- wc_get_template new template does not showing up
- Overriding an Array in a Plugin’s Class/Function from functions.php
- WordPress: Add custom add_filter for custom functions
- how to make dynamic subdomain for each user registering?
- Completely remove ability to create users?
- Defining the value of a variable before a function?
- How to get custom minimum price in Woocommerce
- Error using wordpress functions inside a plugin class
- Randomize post (and page) IDs on generation
- Share my WordPress plugin for updating how?
- How to detect 404 url and make this link underline or change background color?
- working code, not working – Plugin Dev
- Nested Actions and Filters
- Configuring default woo commerce login with modal popup
- Dynamically Modify s2member Options
- ACF Taxonomy search on backend (Relationship field)
- register_activation_hook doesn’t fire at all
- Can I add content before post content without using the_content filter
- My ajax request don´t work and return 0
- How can I add a custom checkbox / radio button on the admin theme options to display a CSS or other?
- How to delete posts older than one year with post meta, post attachments and files?
- Paid Memberships Pro, Display User Limit
- Confusing problem with displaying message recipient metadata
- Create csv file in plugin
- getpost content with all formatting for admin pages
- How do add_action and WP_Query
- Add a filter to a different custom plugin
- What is wrong with this dbDelta syntax?
- Call a function with href
- Adding a script & php to functions.php
- Override the plugin class and function
- Activate and deactivate two plugins automatically at certain hours
- Create WordPress category dynamically
- Simple ajax request with Vanilla JS keeps given 400 Bad Request