How to show active version on wordpress.org of a published plugin?

For the current version, make sure you include the Version attribute in your plugin header file. Like this: /* Plugin Name: WordPress.org Plugin Plugin URI: https://developer.wordpress.org/plugins/the-basics/ Description: Basic WordPress Plugin Header Comment Version: 2.3.0 Author: WordPress.org Author URI: https://developer.wordpress.org/ License: GPL2 License URI: https://www.gnu.org/licenses/gpl-2.0.html Text Domain: wporg Domain Path: /languages */ For more detail check … Read more

add_rewrite_rule works in themes function php but when moved into plugin it stops working

When a plugin is activated, the activation hook is the only code that runs on that request. If you flush rewrite rules on activation, your rule isn’t in the array of rules that everything gets rebuilt from, unless you explicitly add it first in the activation hook. register_activation_hook( __FILE__, ‘myplugin_flush_rewrites’ ); function myplugin_flush_rewrites() { // … Read more

What is the best way to embed an JS App in a WordPress Page?

Make the public page a template and then target it with is_page_template() How to create a page template. in your functions.php something like: function wp_25271() { if (is_page_template(‘page-public.php’)) { wp_enqueue_script(‘bootcards’, ‘https://cdnjs.cloudflare.com/ajax/libs/bootcards/1.1.2/fonts/icomoon.svg’, array(‘jquery’), ”, true); } add_action(‘wp_enqueue_scripts’, ‘wp_25271’);

Delete a WordPress transient from a shortcode on Page/Post update

If you will save all data of shortcodes in one variable, you can reset it easy. Example somewhere in shortcode(pseudocode): $page_cache = get_transient(“page_{$page_id}”); if ( empty($page_cache ) ){ global $shortcode_index; $page_cache[$shortcode_index] = **some data that cached**; set_transient( “page_{$page_id}”, $page_cache, **some time** ); $shortcode_index++; **** } And then you can delete it just by page_id on … Read more

Append HTML Using Shortcode

First things first. You shouldn’t really use echo inside a shortcode, unless there is NO way to return the value. In your case your can simply convert it to a function that returns a value: function date_important_info(){ return display_date($date); function display_date($date){ $data = ” <div id=’my-shortcode’ style=””> <span>Date:</span> <span> {$date} </span> </div>”; return $data; } … Read more