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
- Best collection of code for your 'functions.php' file [closed]
- How to include a plugin’s php file to another plugin functions file [duplicate]
- Change Page’s Tag Using functions.php File
- if plugin is active? check if plugin is enabled or not?
- Edit plugin without hooks in functions.php
- How to override a theme function (within a class) using a plugin
- Seeking clarification on page request life-cycle
- How to assign user a role if none is present when logging in
- Custom Widget outputs the input but doesn’t save anything inside the textarea
- How can I let users to access plugin functions based on roles?
- Get User ID from within a plugin
- Is it possible to block subscriber users to changing its password?
- delete_user_meta Delete one value out of array
- Can wp_script_is used in pluginA check if a script is being enqueued/registered from pluginB?
- What is the purpose of $merged_filters?
- Changing image URLs in media library
- Where to place custom functions?
- Display post lists in 2nd paragraph
- creating html reusable blocks via shortcodes
- Fatal error: Call to undefined function cmsms_theme_page_layout_scheme()
- Disqus deleted comments are syncing with wordpress but active comments do not
- How can I change the meta_key for a particular piece of information?
- WordPress metaboxes – textfield suggestion automatically populated
- Which file of wordpress manage plugins functionalities?
- Understanding State in WordPress Multisites
- JQuery prepend a function
- Is there a plugin for WordPress for creating ‘Accounts’ where all users who belong to that Account can only see Account data? [closed]
- Add User Role: Pre-saved in User-Meta [SOLVED]
- How to make a dynamic css class whose name changes every visit to confuse scraper
- Filter to wp_list_authors
- Send email with list of active plugins upon activation/deactivation
- Using custom fields for image alt and title
- How limit user connection?
- Set up functions to be overridden without using function_exists() by short-circuiting them?
- Add the_post_thumbnail_url to a shortcode in function.php
- Add action to custom Function
- WordPress /users/me endpoint request forbidden
- Help with a function in a widget
- Adding a Tag Parameter / Filter to My Shortcode
- How do I create pages within a WordPress post?
- Shortcode not displaying HTML within the function
- Janrain/Simple Modal under Redirected Domain
- Cookie value changes back to previous value after changing
- RSS Feed on WordPress showing code (hypertext) in articles titles
- Alternative Hook to the_content for Changing Background Color
- Post source link plugin – small modification
- Can we hide a certain user in WP?
- Hide Plugin Custom Post Type Menu Link
- How to create algorithm for ordering posts in WordPress?
- Does having apply_filters in the middle of an array make a difference?
- Block plugin update possibilities (but not by hiding notifications)
- Execute function activate/deactivate plugin in specific pages
- How do I run my custom function in my plugin when a wordpress user is deleted?
- Remove action added in plugin class from theme
- Soflyy WP All Import Custom File Download Issue
- Using multi-dimensional array with filter
- Update (a function) post’s featured image as soon as $image_url changes
- Custom User Notice Upon Login
- Why can’t I shove an instance of a class into a variable from a do_action hook?
- How to order users alphabetically by name? in plugin UPME
- Passing a parameter to filter and action functions
- Why isn’t my plugin seeing other classes?
- How to add submenu to WordPress plugin in the same Directory of main Plugin?
- How change menu for each user in plugin?
- Contact Form 7: custom validation [closed]
- Adding a Filter to Sidbar Login Plugin to Change Login Button Lable
- Simply Exclude – Category feed exclusion is excluding from category feed instead of just the main feed
- How use Dynamic hyperlink on each wordpress post?
- How to declare this function correctly?
- PHP if url extension action=discussion condition use [closed]
- How to add product thumbnail on orders list on backend?
- How to disable plugin capability : “create new category”
- Option value not getting updated until page refresh in WordPress
- WordPress Custom Page Blog Template Pagination Problem (Pagination Not Displaying)
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode