How do I add a checkmark to my-sites save settings hook

It sounds as though have altered the page to submit your data. Assuming that that code work properly: my-sites.php loads admin.php 10 require_once( dirname( __FILE__ ) . ‘/admin.php’ ); Which fires the load-{pagenow} hook 330 /** 331 * Fires before a particular screen is loaded. 332 * 333 * The load-* hook fires in a … Read more

Add action hook into wp_localize_script

Everything is working as expected. The problem is that your hook is rendering content to the page and you would like to pass that output to the javascript variable included in the JS output. You need to capture the hook output into a variable then add to $data. // buffer output ob_start(); // run hook … Read more

how to make custom ajax handler?

You have to include WP core function files, something like this… <?php //mimic the actuall admin-ajax define(‘DOING_AJAX’, true); if (!isset( $_POST[‘action’])) die(‘-1’); //make sure you update this line //to the relative location of the wp-load.php require_once(‘../../../../../wp-load.php’); //Typical headers header(‘Content-Type: text/html’); send_nosniff_header(); //Disable caching header(‘Cache-Control: no-cache’); header(‘Pragma: no-cache’); You can read more about this here https://coderwall.com/p/of7y2q/faster-ajax-for-wordpress … Read more

Footer disappears when using the_content ( )

An important difference from the_content() is that get_the_content() does not pass the content through the ‘the_content’. This means that get_the_content() will not auto-embed videos or expand shortcodes, among other things. If you find yourself annoyed with formatting of the content, more specifically the added p-tags that WordPress puts into the content that you didn’t. Just … Read more

schedule event in class oriented plugin

This reason, and others (removing a hook for example) is why you should use for hooks only plain functions or static functions. OOP in plugins and themes rarely has anything to do with proper OO. If you use it as a way to have a separate namespace, then just use a namespace.

How to cancel the trash action inside wp_trash_post

It’s possible to utilize the pre_delete_post filter to short-circuit the deleting of posts. add_filter( ‘pre_delete_post’, ‘wpse_224246_pre_delete_post’, 10, 3 ); function wpse_224246_pre_delete_post( $delete, $post, $force_delete ) { //* Escape early if post isn’t already trashed if( ‘trash’ !== $post->post_status ) { return $delete; } //* Go ahead with deleting the post if the current user is … Read more

Custom Front End Registration – How Does the Key work in the Password Set Request?

Because I couldn’t find an answer on this, I handled it myself by setting my own cookie in the function and checking that. Here is the revised function: function custom_login_init () { $action = isset($_REQUEST[‘action’]) ? $_REQUEST[‘action’] : ‘login’; if ( isset( $_POST[‘wp-submit’] ) ) { $action = ‘post-data’; } else if ( isset( $_GET[‘reauth’] … Read more