How to create Admin Notice from Plugin with argument? [duplicate]

This would be an good use PHP 5.3+ anonymous functions. Closure example: <?php function Twit_the_url( $post_ID ) { //connect to twitter api //send tweet with url //get twitter response //send response to admin notice : add_action(‘admin_notices’, function() use ($httpstatus) { echo ‘<div class=”error”><p>’, esc_html($httpstatus), ‘</p></div>’; }); return $post_ID; } add_action( ‘publish_post’, ‘Twit_the_url’); Alternatively, you could … Read more

Plugin Scripts no loading on options page

Hey use admin_enqueue_scripts. if you want to load a set of CSS and/or Javascript documents to all admin pages. You can do this from within your plugin or from your themes function file using admin_enqueue_scripts: function class_table_scripts() { wp_register_script( ‘JavaScript1’, plugins_url(‘js/wcs.css’), array() ); wp_enqueue_script(‘JavaScript1’); wp_register_script( ‘JavaScript1’, plugins_url(‘js/jquery.qtip-1.0.0-rc3.min.js’), array(‘jquery’) ); wp_enqueue_script(‘JavaScript1’); } add_action( ‘admin_enqueue_scripts’, ‘class_table_scripts’ );

Which hook to add action on specific page?

wp_loaded hook is too early for environment to be completed and for conditionals to work. You need to do this a little later, for example on admin_head hook. PS also use get_the_ID() for cleaner look 🙂

Basic function call on init failing

I am going to suggest that what you are doing is overly complex, at least insofar as I understand you. You can determine whether your shortcode has been registered using the Core function shortcode_exists, which returns a boolean. As far as I can tell, using that should provide completely equivalent functionality to your code above.

change order of add_action hooks for jquery to be loaded first

I think the real answer here, is to have the plugin author load scripts properly using wp_enqueue_script(). Or, you could change the theme enqueue code to output jquery to the header by changing to this (not great for performance reasons, but relatively simple): wp_enqueue_script( ‘jquery’, get_template_directory_uri() . ‘/js/jquery/jquery.min.js’, array(), ‘1.0.0’, false ); Or, you could … Read more

What is the action hook that deletes a taxonomy term from the backend? And how to retireve the term id before deleting it?

Actually, you can use multiple actions, at least this is what at the end of the wp_delete_term function, which runs when you click Delete on a taxonomy term: do_action( ‘delete_term_taxonomy’, $tt_id ); do_action( ‘deleted_term_taxonomy’, $tt_id ); do_action( ‘delete_term’, $term, $tt_id, $taxonomy, $deleted_term ); do_action( “delete_$taxonomy”, $term, $tt_id, $deleted_term ); The last one my be the … Read more