shortcode tags not working in do_shortcode

You maybe need to return the output at the end of the function, then do’t forget to echo the do_shortcode(). function shortcodename_function($atts) { $pairs = array( ‘title’ => ‘bananas’ ); $a = shortcode_atts($pairs, $atts); return $a[‘title’]; } echo do_shortcode(‘[shortcodename title=”monkeys”]’); Of course you can echo directly in the function, but it’s a bad pratice for … Read more

How can I control if post updated

add below action in your main function file of your plugin add_action( ‘wp_insert_post’, ‘my_project_updated_post’, 10, 3 ); function my_project_updated_post( $post_id, $post, $update ) { // your code goes here // Every time you will get updated or newly created post id here. }

Reporting errors in a shortcode plugin

Take a look at admin notices. If you the cols parameter isn’t set use some code like this: function sample_admin_notice_fail() { ?> <div class=”notice notice-error is-dismissible”> <p><?php _e( ‘You forgot the cols parameter!’, ‘sample-text-domain’ ); ?></p> </div> <?php } add_action( ‘admin_notices’,’sample_admin_notice_fail’ ); to display this notice: on top of your admin page. You find some … Read more