How does add_action ‘comment_post’ work?
How does add_action ‘comment_post’ work?
How does add_action ‘comment_post’ work?
You can simply remove those menu items in your check_username method. add_action(‘admin_init’, ‘check_username’); function check_username() { $user = wp_get_current_user(); if( $user && isset($user->user_email) && ‘[email protected]’ == $user->user_email ) { remove_menu_page(‘tools.php’); remove_menu_page(‘themes.php’); remove_menu_page(‘options-general.php’); remove_menu_page(‘plugins.php’); } } Your code doesn’t work, because the admin_init action is invoked after admin_menu. Please see the Action reference page in WordPress … Read more
You have to add the metadata information with the new b&w thumbnail: $meta[‘sizes’][‘thumbnail-bw’] = array( ‘width’ => $meta[‘width’], ‘height’ => $meta[‘height’], ‘file’ => $file ); after generating the new image (after the switch block). There ‘s also a plugin, called Grayscale, that does exactly what you need.
Actually all I had to do is, run theme options inside the function, like this: function mytheme_under_construction(){ global $mytheme; if(!empty($mytheme[‘offline_id’])){ // if user is logged in, don’t show the construction page if ( is_user_logged_in() ) { return; } $protocol = $_SERVER[“SERVER_PROTOCOL”]; if ( ‘HTTP/1.1’ != $protocol && ‘HTTP/1.0’ != $protocol ) $protocol=”HTTP/1.0″; // 503 is … Read more
Suppress the_content filter in a nested loop
Filter for modifying image on upload
I am not sure if I understand your question right but you seem to misunderstand a bit how PHP requests are typically executed. $wpdb is not persistent, it belongs to specific page load and only exists while that page load is being performed. Unless your code always changes it – independent second (third, etc) page … Read more
You must register callbacks before they are called (add_action() and add_filter() are registration functions, they remember what to do when). Try the following in your functions.php or in your plugin: add_action( ‘topofthetop’, ‘load_FB_JS_SDK’ ); function load_FB_JS_SDK() { if ( is_singular() && have_comments() ) someclass::FB_JS_SDK(); }
Unsure how to add simple checkboxes that write to a small table to admin
My suggestion would be to add in a simple flag that checks whether this is the initial time we’ve set our defaults, something such as below: function initial_product_data ( $post_id ) { // lets get out of here if this is not a new product if ( ‘product’ != $_POST[‘post_type’] ) return; //Grab our initial … Read more