• Hello good!
    I have a problem creating a custom tag in contact form

    add_filter("wpcf7_special_mail_tags", function( $output, $name, $html ) {
    	if ( $name === "_current_url_cs" ) {
    		
    		$page_id = get_the_ID();
    		$extra_email = get_field('email_del_centro', $page_id);
    		if ($extra_email) {
    			return $extra_email;
    		}
    		
    	}
    	return $output;
    }, 99, 3 );

    here I am creating the custom tag “_current_url_cs”
    What I want is to collect the acf of the page from which the email is sent
    The code works correctly but if I pass the id of a page to $page_id ( $page_id = 555 );
    The error is that I want the ID of the page from which it will be sent to be saved in that variable.
    For example: if the form is sent from the page with id 555, let the variable detect that ID and save it in that variable
    I thought about doing this: $page_id = get_the_ID(); as indicated in the example but it does not detect the ID

    The page I need help with: [log in to see the link]

  • The topic ‘DOES NOT collect the page id when creating a custom tag’ is closed to new replies.