WordPress posts_per_page does not work

Use below code.

$web = array( 'posts_per_page' => 5,
    'orderby' => 'date',
    'order' => 'DESC',
    'no_found_rows' => true,
    'update_post_term_cache' => false,
    'update_post_meta_cache' => false,
    'nopaging' => true,
    'post_type' => 'product'
);
$query = new WP_Query( $web );

Upload file into WordPress

if ( ! function_exists( 'wp_handle_upload' ) )
require_once( ABSPATH . 'wp-admin/includes/file.php' );

$uploadedfile = $_FILES['resume'];
$upload_overrides = array( 'test_form' => false );
$movefile = wp_handle_upload( $uploadedfile, $upload_overrides );
if ( $movefile ) {
   echo $movefile['url'];
   echo 'Success';
}else{
   echo 'Fail';
}

How to check selected product in previous customer orders or not

$seletedProduct = 25;
$exist = ‘no’;
if(is_user_logged_in()){      // Check for customer login
$orders = get_posts( array(
‘numberposts’ => -1,
‘meta_key’ => ‘_customer_user’,
‘meta_value’ => get_current_user_id(),
‘post_type’ => ‘shop_order’,
‘post_status’ => array(‘wc-completed’, ‘wc-processing’)
) );
foreach ($orders as $order) {
$WC_Order = new WC_Order($order->ID);
$items = $WC_Order->get_items();
foreach ( $items as $item ) {
if($item[‘product_id’] == $seletedProduct){
$exist = ‘yes’;
}
}
}
}
if($exist == ‘no’){
echo ‘Product not ordered’;
}else{
echo ‘Product already ordered’;
}

Disable plugin updates in WordPress

Disable all plugin updates:-
function aviweb_disable_plugin_updates( $values ) {

foreach($values as $value) {
unset( $value->response[‘plugin/plugin.php’] );
}
return;
}
add_filter( ‘site_transient_update_plugins’, ‘aviweb_disable_plugin_updates’ );

Disable single plugin update:-
function aviweb_disable_plugin_updates( $value ) {
unset( $value->response[‘plugin_name/plugin_file.php’] );
return $value;
}
add_filter( ‘site_transient_update_plugins’, ‘aviweb_disable_plugin_updates’ );