Shortcodes in WordPress are specific codes that allow the developers to do various tasks with minimal effort. Shortcodes are used to simplify tasks such as creating objects or embedding files that require lots of coding in a single line. A Shortcode is synonymous to the shortcut. WordPress has five built-in shortcodes- audio, embed, caption, video, and gallery.

BY Best Interview Question ON 02 Feb 2019

Example

1. You can call shortcode function like this :
echo do_shortcode('[display_related_posts]');

2. In your function.php you can make
function display_related_posts($array = array()) {
      return 'BestInterviewQuestion.com';
}
add_shortcode('display_related_posts', 'display_related_posts');