WP Shortcode - retrieve author page url

/ Published in: PHP
Save to your folder(s)

Using shortcode to retrieve the author page url (ex. abc.com/?author=123), using the WP Shortcode API as reference.

Copy this code and paste it in your HTML
  1. //retrieve author page url (ex. http://www.abc.com/?author=123) by using shortcode [XXXXX id=123]
  2. function XXXXX_func($atts) {
  3. extract(shortcode_atts(array(
  4. "id" => '1'
  5. ), $atts));
  6. return get_author_posts_url($id);;
  7. }
  8. //add shortcode [XXXXX id=123]
  9. add_shortcode('XXXXX', 'XXXXX_func');

URL: http://codex.wordpress.org/Shortcode_API

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.