How to find out the page name or slug inside a filter?

How do I find the page name or page slug inside a filter in a plugin?

I am customizing a plug-in and I need to run some code based on which page is currently being displayed.

The code is inside a function (let’s call it FunctionA() ), which is called by a filter:

add_filter( 'woocommerce_registration_errors', 'FunctionA', 10 ); 

I’ve tried all the options described here and a few more I found googling, but everything seems to return NULL or blank (instead of the page slug, page name, $ post or whatever other variable is suggested).

Here is a bit more of the code:

function FunctionA( $  errors ) {      $  fields = FunctionB_get_account_fields();      foreach ( $  fields as $  key => $  field_args ) {          // if none of the fields are required,          // don't produce any errors and check next field         if ( empty( $  field_args['required'] ) ) {              continue;           }           if ( isset( $  _POST['register'] ) ) {              //Here I want to do something like:              // if (current_page_slug = 'vendor_reg_page') {              //      if( ! empty( $  field_args['hide_in_vendor_registration'] ) ) {             //          continue;             //       }              // }else if(current_page_slug == 'other_reg_page'){             //         if( ! empty( $  field_args['hide_in_other_registration'] ) ) {             //          continue;             //       }             //}            }          if ( empty( $  _POST[ $  key ] ) ) {              $  message = sprintf( __( '%s is a required field.', '<strong>' . $  field_args['label'] . '</strong>' );             $  errors->add( $  key, $  message );         }     }      return $  errors; }  add_filter( 'woocommerce_registration_errors', 'FunctionA', 10 ); 

What do I need to do to get the page name, slug or some other thing that identifies from where the form is being posted? I am able to get the page slug without any problems inside an action in this same plugin, but doing this in a filter does not work. I’m fairly new to wordpress development so I don’t know: is there any way to get the page info in a filter? or is this impossible?

Background info (not necessary to understand the problem, but I’m adding it here for those who are wondering why I’m doing this and are going to suggest things that aren’t doable in my situation): I have a form that appears on 2 pages (3, actually, but let’s simplify the conversation by saying it’s only 2), so I need to know in which page I am currently validating the form, because some fields are required in one page but not in the other. I can’t control the fact that the form appears in 2 different pages (I only want it to appear in one) because this is due to the plugin I am using. It is originally a plug-in to add extra fields to woocommerce customer/user registration page, but it also ends up adding fields in the wcmarketplace vendor registration. I am removing those fields (successfully) based on the page slug in a function (let’s call it FunctionC) being called by an action (add_action( 'woocommerce_register_form', 'FunctionC', 10 );) in this same plugin. But now when it comes to validating I also need to validate the fields based on the current page. And this is where I’m stuck because it seems like WordPress can’t find me the page info inside the filter.