Advertisement
Guest User

Untitled

a guest
Aug 4th, 2023
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. <?php
  2.  
  3. add_filter( 'get_user_metadata', function( $meta_value, $user_id, $meta_key ) {
  4.     preg_match( '/^edit_(.*)_per_page$/', $meta_key, $matches );
  5.     if ( is_array( $matches ) && ! empty( $matches[1] ) ) {
  6.         global $wpdb;
  7.         $per_page = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->usermeta WHERE meta_key = %s AND user_id = %d", $meta_key, $user_id ) );
  8.         if ( ! $per_page ) {
  9.             $meta_value = 100;
  10.         }
  11.     }
  12.     return $meta_value;
  13. }, 10, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement