Skip to content
SpellTech4Ever

  • Home
  • Featured
  • Wearables
  • Space Tech
  • Mobile Apps
  • Linux Server
  • PHP
  • WordPress
    • Snippets
  • Suggest content
WordPress Snippets

Create a custom shortcode for WordPress

December 3, 2022 André Amorim
<?php
add_shortcode('your_code', 'my_function');

function my_function() { 
  $message = 'Hello world!'; 
  return $message;
}

Source: Create a shortcode in WordPress (github.com)

  • Rename the default WP taxonomy: category
  • Add a custom option page to WordPress Options

One thought on “Create a custom shortcode for WordPress”

  • André Amorim
    December 4, 2022 at 12:04 AM
    Permalink

    For shortcode with parameters, check this: https://developer.wordpress.org/plugins/shortcodes/shortcodes-with-parameters/
    https://wordpress.stackexchange.com/questions/172919/how-to-create-a-shortcode-with-1-parameter-atts

    Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Recent Posts

  • Change default error message on login
  • Hide Gravity Forms uploads from users without login
  • Block default endpoint users
  • Check for wordpress theme updates
  • Check for wordpress plugin updates

Archives

  • March 2024
  • December 2023
  • November 2023
  • March 2023
  • December 2022
  • November 2022
  • May 2022
  • April 2022
  • November 2021
  • August 2021
  • July 2021
  • June 2021

Categories

  • Apache
  • Featured
  • Linux Server
  • Mobile Applications
  • MySQL
  • PHP
  • Space Technology
  • SSH
  • Technology
  • Wearable Techology
  • WordPress
  • WordPress Snippets

Your blog that presents articles of different type of technologies.

If you have your own notes about various topics about your work related to technology, why not share them? Contact us if you want also to make part of this project.

Recent

  • Change default error message on login
  • Hide Gravity Forms uploads from users without login
  • Block default endpoint users
  • Check for wordpress theme updates

Categories

  • Apache (2)
  • Featured (7)
  • Linux Server (5)
  • Mobile Applications (3)
  • MySQL (1)
  • PHP (2)
  • Space Technology (3)
  • SSH (1)
  • Technology (13)
  • Wearable Techology (4)
  • WordPress (4)
  • WordPress Snippets (43)

Tags

#admin #apache #api #application #attachments #automatic #automatic-updates #blocks #categories #coding #custom #dashboard #default #disable #display #enable #endpoints #futuristic #hide #html #linux #login #mobile #panel #php #platform #plugins #posts #programming #remove #rest-api #RSS #screen-options #security #server #shortcode #space #technology #text-widgets #themes #top-bar #ubuntu #updates #wearabletech #widget
Copyright © 2025 SpellTech4Ever All rights reserved | Privacy Policy.
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
SAVE & ACCEPT