Home Wordpress Hooks Best Practices – Wordpress Plugin Making

Best Practices – Wordpress Plugin Making

by therichpost
How to add custom meta title and meta description in Wordpress?

Hello to all, welcome to therichpost.com. In this post, I will tell, Best Practices – Wordpress Plugin Making.

Wordpress is the top CMS in the world and I personally like it very much.

Today I am going to tell, how wordpress plugin will make with proper wordpress standards.

In this post, I will create plugin folder->  files->  classes-functions-shortcode-hooks->  zip->  uploadAdmin->  getShortcode.

Best Practices - Wordpress Plugin Making


Here are the working and tested code for Best Practices Wordpress Plugin Making:


1. Very First make a  folder named ‘wp-rich-text’.
2. Second, create ‘wp-rich-text.php’ file in ‘wp-rich-text’ folder and below code into it:

This is the main file of plugin, in which we declare plugin info and other methods:

 * Plugin Name: Rich Plugin
 * Plugin URI: #
 * Description: #

define( 'RICH_PLUGIN_DIR' , plugin_dir_path( __FILE__ ));//For calling the files
  require_once( RICH_PLUGIN_DIR. 'class.rich.php' );


3. Next, create, ‘class.rich.php’ file in wp-rich-text’ folder and below code into it:

In this file, we create class and its functions and wordpress hooks:

Plugin classes
class RichData{

  public static function init() {

        function custom_text( $atts ){
            return "test";
        add_shortcode( 'RichText', 'custom_text' );//create shortcode to call the function into admin pages and theme's template files
add_action( 'init', array( 'RichData', 'init' ));
4. Now files and folder structure have been done now make a zip of ‘wp-rich-text’ and upload it from add plugin section into your wordpress dashboard.


5. To call the plugin functionality, we need to add shortcode into our wp-admin posts, pages or theme’s templates files:
// Call the shortcode into wp-admin posts and pages with below code

//Call the shortcode into theme's templates files with below code
echo do_shortcode('[RichText]');


This is done with basic plugin marking tips in wordpress. if you have any query related to it then do comment below or ask questions.

Code Is Poetry,

Thank you,





You may also like


Lettie Edmunds May 17, 2019 - 2:50 pm

Perfectly composed subject material, Really enjoyed
looking through.

Ajay Malhotra May 17, 2019 - 5:27 pm

Thank you Lettie

66ceme September 21, 2019 - 7:02 am

What’s up, yup this post is in fact nice and I have learned lot of things
from it about blogging. thanks.

Ajay Malhotra September 21, 2019 - 7:04 am

Thank you


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.