Is there a log for the ajax calls made when changing a post’s slug?

If we trace the Ajax process after you click OK, we would walk the following path from the core and into the database:

Press OK on Edit slug:
 \
  \-> AJAX POST request with action=sample-permalink  Action:  wp_ajax_sample-permalink
     \
      \-> function: wp_ajax_sample_permalink()
         \
          \-> function: get_sample_permalink_html()   Filter:  get_sample_permalink_html
             \
              \-> function: get_sample_permalink()    Filters: get_sample_permalink, editable_slug
                 \
                  \-> function: wp_unique_post_slug() Filter:  wp_unique_post_slug
                     \
                      \-> db call: $wpdb->get_var() 

So you could hook into some of those filters to check/log what’s happening to your slug generation. You could for example wrap your logging part within the wp_ajax_sample-permalink action:

add_action( 'wp_ajax_sample-permalink', function()
{
    add_filter( 'somefilter', function( $var )
    {
        // --> your EARLY logging part here <---

        return $var;
    }, 0 ); 

    add_filter( 'somefilter', function( $var )
    {
        // --> your LATE logging part here <---

        return $var;
    }, PHP_INT_MAX ); 
} );

where you can adjust the somefilter to your needs.

Leave a Comment