How should I use wpdb class to submit a form in admin dashboard?

If you don’t want to use the Dashboard Widgets API you can use this code snippet that I have quickly concocted as a starting point: function dashboard_daily_post_metabox() { add_meta_box( ‘wt_id’, ‘Daily Post’, ‘dashboard_daily_post_process’, ‘dashboard’, ‘normal’, ‘high’ ); } add_action( ‘wp_dashboard_setup’, ‘dashboard_daily_post_metabox’ ); function dashboard_daily_post_process() { global $wpdb; ?> <form method=”post”> <label>Age <input type=”text” name=”wt_age” value=”<?php … Read more

Get Commentor IP When Marking Comment As Spam

You are missing 2 parameters in your function report_spam. Also the priority should not be 1. Try the code below. add_action(‘transition_comment_status’, ‘report_spam’, 10, 3); function report_spam($new_status, $old_status, $comment){ if($new_status == ‘spam’){ var_dump($comment->comment_author_IP); die; } } I’ve set die so that you can check and manipulate what you want.

Add Button to TinyMCE Custom Menu

That looks like it is an error due to TinyMCE (editorremov I believe) not being loaded yet. Either hook to the admin_footer action instead of admin_head (interestingly you have declared the in_footer option as true and it is still not working) or declare the editorremov dependency when enqueuing your script: wp_enqueue_script( ‘features’, plugin_dir_url( __FILE__ ) … Read more

How can I see a varibles value when my plugin runs?

Using the following modifications and adding in die() stopped the script and output whatever the variables value was at that time. Thanks to @toscho function cf7pp_after_send_mail( $contact_form ) { global $postid; $submission = WPCF7_Submission::get_instance(); if ( $submission ) { $posted_data = $submission->get_posted_data(); $postid = $posted_data[‘_wpcf7’]; $enable = get_post_meta( $postid, “_cf7pp_enable”, true); $email = get_post_meta( $postid, … Read more

Let user override plugin CSS

How about having the location of the CSS file set as an option for the plugin in the admin area? The default setting would be your default stylesheet. The option would allow this to be changed to another specific stylesheet by the user, or removed entirely. If this option exists, your plugin enqueues the stylesheet. … Read more