I’ve tried
I’ve done:
$printedURL = get_sample_permalink_html($post);
error_log(print_r($printedURL,true));
$printedURL2 = wp_ajax_sample_permalink();
error_log(print_r($printedURL2,true));
require_once( ABSPATH . 'wp-admin/includes/post.php' );
$permalink = get_sample_permalink_html( $post->ID, $post->title, $post->$slug );
error_log(print_r($permalink,true));
$permalink = get_sample_permalink_html( $post->ID );
error_log(print_r($permalink,true));
$permalink = get_preview_post_link( $post );
error_log(print_r($permalink,true));
$permalink = get_permalink( $post_ID );
error_log(print_r($permalink,true));
require_once ABSPATH . '/wp-admin/includes/post.php';
error_log(print_r(get_sample_permalink_html( $post_id, $title, $slug ),true));
require_once ABSPATH . '/wp-admin/includes/post.php';
error_log(print_r(get_sample_permalink_html( $post->ID, $post->post_title),true));
error_log(print_r(get_sample_permalink(),true));
and none of these have worked.
Hiya bullshark. It’s not clear in what context your attempts execute. You’d want to utilize a filter hook to log information when a WP function executes. For example:
add_filter('get_sample_permalink', function( $link ) {
error_log( print_r( $link, true ));
return $link;
});
Add to your plugin somewhere where it’ll execute when the plugin loads. Note that this logs entries to your server’s error log file. It does not go to your browser console. If you really want to log to the console, you’ll need an admin JS script that extracts the link from the page’s DOM and then logs to console with console.log()
BTW, I’ve removed your account here from moderation watch. You’ll be able to post without delay again. Please be sure you no longer post duplicate topics anywhere on wordpress.org.