Create a simple shortcode in WordPress

Use code snippet to create a simple WordPress shortcode. I have created a sample shortcode prefix-portfolio with 2 attributes.

Before use change:

  • Change the Prefix with your own unique prefix.
  • Change the prefix with your own unique prefix.

How to use?

  1. Create a new page and add shortcode.
  2. Open the page. It’ll show the output of the shortcode like below:

Code Snippet

Debug WordPress hook sequence

Debug WordPress hook sequence

How it works?

Add query parameter debug in URL e.g. https://<mysite>/?debug. It’ll show the list of hooks in sequence.

Code Snippet

Register or Enqueue Google fonts in WordPress Theme

A valid way to register the Google fonts in the theme or plugin.

Individual site upload limit notice

Show individual site upload limit notice on media page WordPress (Only for Multisite)



Add post meta in post (custom post type) endpoint with Rest API

Add post meta in post (custom post type) endpoint with Rest API.


  • Change post-type with your post type slug.
  • Change prefix-meta-key with your post meta key which you want to include in Rest API Response.


Visit https://<mysite>/wp-json/wp/v2/<post-type>/ it show the stored data from meta key  prefix-meta-key in the Rest API response.