Wordpress: Job Manager: How to modify Resume custom fields? - wordpress

I have been trying to figure out a filter or action to modify Resume custom fields.
There is a documentation here about how to do it for resume core fields but not for custom fields.
If I use submit_resume_form_fields filter like
add_filter( 'submit_resume_form_fields', 'remove_submit_resume_form_fields' );
function remove_submit_resume_form_fields( $fields ) {
$fields only returns resume core fields but not the custom fields.
Can anyone help me?

Finally I got it worked. So instead of using submit_resume_form_fields filter, I used submit_resume_form_fields_get_resume_data and it gave me all the fields (with custom fields as well). Unfortunately I could not find a documentation of this, I had to search the code. So the code goes like
add_filter( 'submit_resume_form_fields_get_resume_data', 'remove_submit_resume_form_fields' );
function remove_submit_resume_form_fields( $fields ) {
unset( $fields['resume_fields']['custom_field_name'] );
}
I thought it might help someone!

Related

Customize woocommerce product name hook

The reason behind doing this is because I am currently had set my default product name hook with a custom function and I am currently trying to set another custom hook to avoid conflict with my default hook. This is what I have here for my custom function(hook). Please feel free to give suggestions on the custom function that I created. (Which is not working at the moment)
The code is below:
add_action('custome_product_name', 'show_product_name');
function show_product_name(){
$product = wc_get_product(id);
echo $product->get_title();
}
Feel free to ask if there is any confusion that I caused. Cheers.
Above one is for (WC version 2.5.2) can let me know which version of WC you are using ?
Can try below action hook please:
add_action('custome_product_name', 'show_product_name');
function show_product_name(){
echo get_the_title( 'ID' );
}

Deleting a Wordpress user using a custom plugin Hook

I am new to wordpress hooks and I am trying to delete a wordpress user using a custom action the plugin Restrict Content Pro provides.
(https://docs.restrictcontentpro.com/article/2054-group-accounts-actions-filters)
What I want to achieve: When a member is removed from a group, their account should be deleted.
Unfortunately my code doesn't work. Any ideas on how to modify it be highly appreciated!
function delete_group_user() {
wp_delete_user($user_id->ID );
}
add_action( 'rcpga_remove_member', 'delete_group_user' );
You are close, your function delete_group_user() does not have $user_id defined. Luckily, it looks like the rcpga_remove_member hook provides that information. Something like this should work:
function delete_group_user($user_id) {
wp_delete_user($user_id);
}
add_action( 'rcpga_remove_member', 'delete_group_user' );
Also, note from the documentation that $user_id is an INT not an object.

Fire function when Stripe has error in WooCommerce

I am trying to fire a custom function when a credit card error occurs in the WooCommerce checkout flow.
I seem to be able to get standard woo errors by using but it seems that the stripe plugin does not us woocommerce_add_error
add_filter( 'woocommerce_add_error', 'my_woocommerce_add_error' );
I found the following hook in the WooCommerce Stripe documentation, but I can't seem to get it to work with add_action
wc_gateway_stripe_process_payment_error ($error, $order) – Called when
an error occurs during the process payment event.
add_action( 'wc_gateway_stripe_process_payment_error', 'test_this' );
What am I missing? Is there another filter or hook that I should be using?
As per documentation https://docs.woocommerce.com/document/stripe/ this hook take 2 params $error, $order so you have to tell it to WordPress:
add_action( 'wc_gateway_stripe_process_payment_error', 'test_this', 10, 2 );
function test_this($error, $order) {
// something
}
It's working fine on my side
The only way I could figure out how to do this is by watching for dod inserts on the dom. This is the code I used below.
Note: You should probably use mutated events these days but for some reason, I couldn't figure it out.
$(document).on('DOMNodeInserted', function(e) {
if ( $(e.target).hasClass('woocommerce-error') ) {
console.log('stripe input error');
}
});

how can I detect that option value has changed in wordpress?

I am working on a Wordpress plugin and I want to fire a different action based on each option value change. so how can I do that ?
Example:
$options = get_option('ACP_settings'); if $options['acp-select'] has changed from previous value than I want to fire different action based on selection
Please note that $option['acp-select'] is retrieved from select/option html form and has following values for selection:'book','air','SW','HW' and etc....
I hope I have posted my question clearly.
thanks for help
You can use wordpress hooks in the update_option() function.
In your case you can use updated_option or update_option_{$option} hooks.
The code for ACP_settings option would look like:
add_action( 'update_option_ACP_settings', function($old_value, $value, $option){
if( $old_value !== $value ){
// Your option was updated
// Run your code here
}
}, 10, 3 );

What is difference between these Wordpress filter hooks

I'm new to WordPress plugin development. I have a doubt about below 3
filter hooks.
content_edit_pre
content_filtered_edit_pre
excerpt_edit_pre
Please tell me the what the difference between these hooks.
content_edit_pre filter hook
The content_edit_pre filter hook is used to hook into the content of a post just before it is loaded to be edited. For example, if you included the following at the end of your functions file:
function test_of_content_edit_pre( $content, $post_id ) {
return "Insert this before the content about to be edited ".$content;
}
add_filter( 'content_edit_pre', 'test_of_content_edit_pre', 10, 2 );
Then open a post to edit it, you would see that the text has been inserted before the post:
excerpt_edit_pre filter hook
The excerpt_edit_pre filter hook is very similar to content_edit_pre, except it is used to hook into excerpts (instead of posts) just before they are loaded to be edited. For example:
function test_of_excerpt_edit_pre( $content, $post_id ) {
return "Add this to excerpt".$content;
}
add_filter( 'excerpt_edit_pre', 'test_of_excerpt_edit_pre', 11, 2 );
Would result in this being shown in the excerpt:
content_filtered_edit_pre filter hook
This one I am not sure about. I tested it out and it didn't seem to do anything. I will update my answer if I can find more information on this.

Resources