I have some difficulties adding a filter from a plugin file. The filter is applied in an AJAX function. The plugin file is included correctly, as all the other code is working perfectly. The other code in the ajax.php file works perfectly.
ajax.php
$user_meta = array(
'lang' => substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2),
'actkey' => $actkey,
);
$user_meta = apply_filters( 'add_more_meta', $user_meta, $_POST );
add_user_meta( $user_id, 'data', $user_meta );
plugin-file.php
function add_more_meta ( $user_meta, $var ) {
//NOT HOOKING
$user_meta['major'] = 'major';
return $user_meta;
}
add_filter( 'add_more_meta', 'add_more_meta', 10, 2 );
The array stays the same and doesn't change.
Anyone got an idea on what I'm doing wrong?