The user_register
action hook only passes 2 parameters and your callback requires 3, which will result in a PHP fatal error. You should instead be using the insert_custom_user_meta
filter like so:
class FootballPoolRegisterNames {
public static function init_extension() {
...
add_filter( 'insert_custom_user_meta', [ __CLASS__, 'insert_custom_user_meta' ], 10, 4 );
}
...
public static function insert_custom_user_meta( $custom_meta, $user, $update, $userdata ) {
$custom_meta[ 'first_name' ] = sanitize_text_field( $_POST[ 'first_name' ] ?? '' );
$custom_meta[ 'last_name' ] = sanitize_text_field( $_POST[ 'last_name' ] ?? '' );
return $custom_meta;
}
}
Related Posts:
- When unit testing a plugin, does the plugin need to be in the wp-content/plugins directory of the WordPress tests install?
- How can I prevent a plugin from updating unless it’s minimum PHP version is met?
- Simple form that saves to database
- How to call plugin path in JS?
- Get Current user email as a return string value
- How can I make content disappear when a user logs in?
- How to save Clicks of a download link button while it doesn’t matter if we refresh the page or again login/logout
- Determining where fopen() is writing files when used from WordPress AJAX call [closed]
- How Restrict access to admin dashboard by specific static ip?
- New Plugin: Post update pushes a copy as a revision
- Overide a function that is inside a plugin
- How to get images from EDD post?
- How to install and activate a plugin via an external PHP script
- How to remove xmlns on language_attributes()?
- How to initialize something in unit test before the init hook being called?
- Add category to body class
- Add keywords meta to index.php page
- Download any file after submitting a form [closed]
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- woocommerce 3.2.1 not sending order notification emails
- Executing my function once on a specific time
- Redirecting a buddyboss profile tab to a different tab if not subscribed to a specific membership
- Add a CSS class based on categroy id to archive pages
- WooCommerce: Building a page with user input which is used to query order status and external API and return a result
- Access WordPress data from external PHP application.
- Why “Call to a member function on a non-object” in plugin only?
- What are the specifics of WordPress development I need to know? [closed]
- How to echo text in browser instead of download junk file?
- How to create a custom post type that contains another custom post type?
- WP Query. Is there a maximum size?
- WP Plugins – Use includes to display page content
- Finding the screen id of a page generated with add_menu_page
- Can i add custom code in Source, Header from function.php?
- How to make multiple admin pages for one plugin?
- Problem with isset and $_POST
- Allowing users to Sign-up > Login > Post articles that need approval
- Redeclare function after plugin activation
- get_edit_post_link() not working on wp-cron
- Woocommerce Backend Search by Title and SKU
- Control page content visibility based on URL parameter
- WooCommerce Shopping Cart Not Initially Showing Products [closed]
- How to translate wordpress error message
- Override a Plugin Function
- Adding a simple Javascript file with a plugin
- How to add/change (woocommerce) product tab icon
- Comment “like” problem – “users who like this” avatar linking to current user profile instead of “liker’s” profile
- I want to generate the pdf and save it in library?
- Add key and value to an array in another file
- How to write to a separate PHP file in plugin settings
- Trying to make a simple wordpress plugin, having difficulties understanding how to make it?
- wordpress plugin license issue -New plugin development
- Dynamic Image Replacement through call rail phone call tracking plugins in wordpress
- How can I show registration form inside modal?
- More gentle way to hook WordPress custom url
- How to display results from a data table with an encrypted user id?
- add_action for publish_post doesn’t work
- How to proper escape echo inside a javascript tag
- How to Call Specific .PHP file on add_submenu_page selection in Plugin Development?
- Checkbox show / hide output result
- Custom Logo Link WordPress
- How to convert Currency from USD to other IP Based currency in Php function
- How do I reinit WordPress plugins dynamically using jS?
- Attempting to list all product categories and the price range of all products within them
- WP Import All Multiple Dynamic Link Imports
- admin_notices show after load completed
- WordPress + python integration
- Newbie problem with adding include wp_footer
- is there a way to display product gallery images via cdn
- Hide content for specific users with id
- adding dynamic/multiple slug values in ‘option_none_value’
- How can I see $post object in frontend from functions.php?
- Move plugin pages from dashboard to front-end
- Get post content inside plugin class method
- Python in WordPress – A “Hello World” implementation
- Compare Ajax Data Results
- WordPress PHP error getting posts from another wordpress blog
- Restrict role to use a plugin
- Creating new option (add_option) from AJAX – Settings API
- Use WP_Query for custom post type but result get empty
- Same Title on two different post type with single custom taxonomy
- Every time I use wp_get_current_user() my plugin breaks
- How to limit each front-end user to view just his own uploaded files on Amazon S3?
- Need help integrating plugin into theme
- resizes images on the fly
- AJAX doesn’t pass variables to the php function in the plugin
- Saving plugin data returns “You do not have sufficient permissions to access this page.”
- Load my plugin before cache
- wp_insert_post() get Fatal Error from Plugin
- Move related products after product summary? [closed]
- wordpress select multiple options and illegal string offset ‘timeslot’ [closed]
- post_exists() returns a 0 but the 0 doesn’t register [closed]
- Adminimize Plugin — Is there an alternative to limiting Editor to ‘Appearance > Widgets’ only?
- Is there a visual editor specifically for page snippets/sections?
- TML Theme My Login Plugin
- Foreach retun in shortcode
- Allow direct access to files/folders within WordPress to replace wp-admin
- How to trigger plugin migration code when plugin updates?
- How to Save Category and Delete Category in same Function
- I want to move the one click accesbility button on bottom of my website screen,
- WordPress : how to create onglet and remove it when only one