When I try to edit my profile fields from my own contact dashboard as seen in the two images attached and click save, It does not seem to invoke civicrm_post hook in WordPress instance. enter image description here

add_filter( 'civicrm_post', 'alter_profiles_event', 10, 4  );

function alter_profiles_event($op, $objectName, $objectId, &$objectRef){
   if ($objectName == 'Profile'){
    //does not enter here.

How can I make sure the hook is invoked?

  • I'd be surprised if civicrm_post didn't fire at all. Have you traced without testing for $objectName? – Christian Wach Sep 17 '18 at 21:14

Add following line before add_filter function:

require_once(ABSPATH . 'wp-includes/pluggable.php');

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.