I have a wordpress site that crashed and I'm rebuilding it. The previous site used rb-internal-links for internal links. Unfortunately, this package is no longer supported.

rb-internal-links allowed me to have internal links with tags that looked like this: [intlink id="184" type="page"]. I have a lot of pages like this. The id is presumably the post number. of of my links have id='page-title' however.

EDIT: The advantage of using this plugin is that you don't need to know the absolute path for every page, and you can rename pages or change your permalink scheme without having to redo every page.

What is the correct way to implement internal links like this on modern wordpress, and how can I fix all of my links?

  • 2
    Internal links are just links to pages on your site, they shouldn't require a plugin. What exactly does this plugin do? Can't you just add links the normal way in the editor? Commented Jul 24, 2022 at 9:22
  • I added some information in the edit. The advantage of this plugin is that you get a layer of indirection, which is usually a good thing.
    – vy32
    Commented Jul 25, 2022 at 3:58
  • I don't know what "of of my links have id='page-title' however." means - or if "modern WordPress" means the Block Editor or just something functional in the current legacy editor - but I've provided a shortcode solution for post IDs.
    – bosco
    Commented Jul 25, 2022 at 6:04

1 Answer 1


Linking to post regardless of permalink settings can always be accomplished by linking directly to a post ID query; i.e. instead of /category/recipe/chicken-piccata, link to /index.php?p=1234.

If you'd like to resolve the URL via shortcode prior to creating the link, replicating the functionality of the original plugin should be simple enough - just take in an ID, look up the post's permalink, and return it in an anchor element:

function wpse407943_post_link_shortcode( $atts = [], $content = '' ) {
  if( !isset( $atts['id'] ) )
    return '';

  $permalink = get_permalink( $atts['id'] );

  if( !$permalink )
    return '';

  $title = get_the_title( $atts['id'] );

  if( !$content )
    $content = $title;

  return '<a href="' . $permalink . '" title="' . $title . '">' . $content . '</a>';

add_shortcode( 'intlink', 'wpse407943_post_link_shortcode' );

It's worth a mention that permalink settings changing with any frequency will damage SEO, and also that this sort of solution comes with overhead - any post linked in this fashion will be retrieved from the database on each load of the respective pages.

I'm not sure why the original plugin might have required the post type as an input, unless it was shortcutting get_permalink() as an optimization to avoid a database hit. If you intend to make heavy use of such a shortcode, it may be worth investigating further.

  • Thanks. I need to figure out how many of my posts use this feature.
    – vy32
    Commented Jul 26, 2022 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.