Can’t save custom field on registration page

You need to use the show_user_profile, edit_user_profile, personal_options_update, and edit_user_profile_update hooks. You can use the following code format adding additional fields in User section. add_action( ‘show_user_profile’, ‘extra_user_profile_fields’ ); add_action( ‘edit_user_profile’, ‘extra_user_profile_fields’ ); function extra_user_profile_fields( $user ) { ?> <h3><?php _e(“Extra profile information”, “blank”); ?></h3> <table class=”form-table”> <tr> <th><label for=”address”><?php _e(“Address”); ?></label></th> <td> <input type=”text” name=”address” … Read more

Disadvantage of using filters & hooks multiple times

Creating a program should be a balanced on how the efficiency of the code work and how easy for future maintenance. For programming efficiency, both style 1 and style 2 of your code is not make a huge impact much. Because of in nowaday PHP, it converts the code into the bytecode only one time, … Read more

Convert Gravity Form Entry Date on Export

You can’t modify date_created on Export Gravity Forms date_created field isn’t actually a field that’s affected by that hook. If you look in /exports.php you’ll find in start_export() that they bypass the filter for ID’s date_created and payment_date and hard-code force the use of Y-m-d H:i:s foreach ( $leads as $lead ) { GFCommon::log_debug( __METHOD__ … Read more

How to add_filter html template to middle of content

You should use add_filter() instead of apply_filters(). apply_filters() is used to apply the filter that’s been registered with add_filter(). Please check the following code for the solution – function bbtre_amazon_content_filter( $content ) { if ( ! is_single() ) { return $content; // Return early if not single post } // Paragraphs array without the closing … Read more

Theme activation hook in php class

It looks like you are adding the hook just inside the body of the class. Try adding it into an init() method and calling it after it is instantiated or at the very least in the constructor. I think the issues is that the hook is being registered before the class has been fully read … Read more

How to direct user after comment save

Use the filter comment_post_redirect: add_filter( ‘comment_post_redirect’, ‘comment_redirect’ ); function comment_redirect( $location ) { $location = ‘http://example.com/sample-page’; // or: // $location = get_page_link( page_ID ); // $location = get_page_link( get_page_by_path( ‘sample-page’ )->ID ) return $location; }

How to re-arrange this hooked content?

To override action that use in plugin, use can wrap the remove_action code in template_redirect action to make sure your action will be excute later. For example add_action(‘template_redirect’, function() { // Remove the title. remove_action(‘sensei_course_content_inside_before’, array( ‘Sensei_Templates’, ‘the_title’ ) ,5, 1 ); // Add it again add_action(‘sensei_course_content_inside_before’, array( ‘Sensei_Templates’, ‘the_title’ ) ,15, 1 ); }, … Read more