Ajax.load

    $("#debtor-customer-filter").on('submit', function(e) {
        e.preventDefault();
        var data = new FormData(this);

        $("#debtors-table").DataTable().destroy();
        $("#debtors-list").load("debtor/filterCustomerDebtorById", {
            debtorFilter: $("#customer-filter").val(), // This set's the status to fetch all records
            fromDate: $("#from-date").val(),
            toDate: $("#to-date").val(),
            cid: $("#customer-id").val()
        }, function (response,status,xhr) {
            $("#debtors-table").DataTable();
            fetchDebtors(response);
        });
    });

    function fetchDebtors(response) {
        $(this).html(response);
    }

xDebug PHP Wizard

Setting up xDebug is a bit of a pain as the links are not clearly linked.
So below is some info to help you 😉

In order to use the Install Wizard.
Open your PHPinfo() page from the xampp default dashboard page
http://localhost/dashboard/phpinfo.php

Copy all "Ctrl+A" and paste into the install wizard box and you will get further instructions

The Install Wizard (I think this is mainly for windows. Linux and mac can use terminal)
https://xdebug.org/wizard

Here's the downloads you going to need as the one you get from the wizard is not working. (currently at the time of this post creation)
https://xdebug.org/download#releases

WordPress Only allow users to see their own media uploads

// Limit media library access
  
add_filter( 'ajax_query_attachments_args', 'wpb_show_current_user_attachments' );
 
function wpb_show_current_user_attachments( $query ) {
    $user_id = get_current_user_id();
    if ( $user_id && !current_user_can('activate_plugins') && !current_user_can('edit_others_posts
') ) {
        $query['author'] = $user_id;
    }
    return $query;
} 

Remove menu items for non admins

function TRIM_ADMIN_MENU() {
    global $current_user;
    if(!current_user_can('administrator')) {
        remove_menu_page( 'tools.php' ); // No tools for <= editors
        remove_menu_page( 'activity_log_page' ); // Activity log
    }
}
add_action('admin_init', 'TRIM_ADMIN_MENU');

WordPress unregister post type

if( !function_exists( 'plugin_prefix_unregister_post_type' ) ) {
    function plugin_prefix_unregister_post_type(){
        unregister_post_type( 'project' );
    }
}
add_action('init','plugin_prefix_unregister_post_type');

Create New Post Type – WordPress Native

function create_posttype() {
  register_post_type( 'wpll_product',
    array(
      'labels' => array(
        'name' => __( 'Videos' ),
        'singular_name' => __( 'Video' )
      ),
      'public' => true,
      'has_archive' => true,
      'rewrite' => array('slug' => 'videos'),
    )
  );
}
add_action( 'init', 'create_posttype' );

Easy Javascript Wizard

INTRO JS

https://introjs.com/example/hello-world/index.html

Wizard steps are managed with simple HTML attributes

data-step="1" data-intro="This is a tooltip for wizard step 1!"
data-step="2" data-intro="This is the second tooltip for wizard step 2!"
data-step="3" data-intro="This is the third tooltip for wizard step 3!"

The below script needs to be added to

$(document).on('click', '#wizard', function(e) {
    e.preventDefault();
    introJs().start();
});

Ajax Post

In the Ajax submits you will see a variable. formdata
The below snippet is what you must append to the top of your Ajax call to initiate the variable
Otherwise you need to change the variable to what ever you are targeting.

var formdata = new FormData;
formdata.append("commId", $("#template-id").val());
    $("#product-form").on('submit', function(e) {
        e.preventDefault();
        $.ajax({
            type: 'POST',
            url: 'strategy/create-product',
            data: new FormData(this),
            contentType: false,
            dataType: 'json',
            cache: false,
            processData: false,
            success: function(response) {
                if (response.success) {
                    location.href = "product/index"
                } else {
                    PNotify.error({
                        title: 'Error Saving Product',
                        text: response.message,
                        mode: 'light'
                    });
                }
            }
        });
    });
        $.ajax({
            type: 'POST',
            url: 'products/save-email-template',
            dataType: 'json',
            data: formdata,
            processData: false,
            cache: false,
            contentType: false,
            success: function (response) {
                if (response.success) {
                    PNotify.success({
                        title: 'Success!',
                        text: response.message,
                        styling: 'material',
                        mode: 'light',
                        maxTextHeight: null,
                        delay: 2000,
                        destroy: true,
                        closer: true,
                        sticker: false
                    });
                    setTimeout(() => {
                        location.reload();
                    }, 500);
                } else {
                    PNotify.error({
                        title: 'Error!',
                        text: response.message,
                        styling: 'material',
                        mode: 'light',
                        maxTextHeight: null,
                        delay: 2000,
                        destroy: true,
                        closer: true,
                        sticker: false
                    });
                }
            }
        });