Permalink instead of page id in views

Labels

This Discussion is public

Notifications

Hi,

You can add [post_id] in your views but the final address is [site_url]/?p=[post_id]

Add the shortcode in your function file

function get_ps_perm( $atts ){
$atts = shortcode_atts( array(
'id' => 0
), $atts, 'ps_perm' );
return get_permalink($atts['id']);
}
add_shortcode('ps_perm', 'get_ps_perm');

Then use [ps_perm id=[post_id]] in your link like

<a href="[ps_perm id=[post_id]]">your link</a>

Reply to this Discussion