Hook to add time mark to redirects

#170223
  • Resolved Jose Lazo
    Rank Math free

    Hi,

    I love your plugin. I’m working around adding a time mark to every redirection.

    First of all, I believed that you create redirections like a Custom Post Type, so I thought would be easy for me, but I realized that you add a couple of new tables in the database.

    I want to know if there are any hook to add a custom field in the redirection editor (like redirection_url_to).

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Anonymous
    Rank Math free

    Hi,

    Yes it’s possible to add custom field using the action hook cmb2_after_form Here is a sample code on how you can add fields under the redirections form.

    add_action( 'cmb2_after_form', function ( $cmb_id ) {
        
        // Check if this form is for redirections
    	if ( $cmb_id == 'rank-math-redirections' ) {
    
    	    // Add your custom field here
    	}
    } );
    

    To save the custom field data you need to use this action hook admin_post_rank_math_save_redirections. Here is a code sample

    add_action( 'admin_post_rank_math_save_redirections', function () {
        // Save data from $_POST
    } );
    

    To store the custom data you might need to use another table or a new custom table.

    Please let me know if you have any more questions regarding this. Looking forward to helping you.

    Thank you

    Thanks you so much Jaed.

    This is just I looking for!

    Hello,

    We are super happy that we have addressed your concern. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind us asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘Hook to add time mark to redirects’ is closed to new replies.