‌ওয়ার্ডপ্রেসে ইউজার লুকিয়া রাখা

আপনি যদি চান আপনার ‌ওয়ার্ডপ্রেসে সাইটে আপনার অ্যাডমিনিস্ট্রেটর ইউজারটি অন্য ইউজার (এমনকি অন্য অ্যাডমিনিস্ট্রেটর) থেকে লুকিয়ে রাখতে, তাহলে সহজেই functions.php দ্বারা তা করতে পারবেন। এজন্য নিচের কোড থিমের functions.php ফাইলে কপি/পেস্ট করে সেভ করুন।

add_action('pre_user_query','royal_hide_user_query');
function royal_hide_user_query($user_search) {
  global $current_user;
  $username = $current_user->user_login;

  if ($username !== 'smmehdiakram') { 
    global $wpdb;
    $user_search->query_where = str_replace('WHERE 1=1',
      "WHERE 1=1 AND {$wpdb->users}.user_login != 'smmehdiakram'",$user_search->query_where);
  }
}	

add_action('admin_head','hide_user_count');
function hide_user_count(){
?>
<style>
.wp-admin.users-php span.count {display: none;}
</style>
<?php
}

ব্যাস এবার ড্যাশবোর্ডের ইউজার্সে গিয়ে দেখুন smmehdiakram নামের ইউজারটি দেখা যাচ্ছে না।
এখানে ইউজারের নাম হিসাবে smmehdiakram ব্যবহার করা হয়েছে।

৪ Comments on "‌ওয়ার্ডপ্রেসে ইউজার লুকিয়া রাখা"

Leave a Reply to bdtutorsCancel reply

×
কপিরাইট © ২০০৬-২০২৪ সমকাল দর্পণ. সর্বস্বত্ব সংরক্ষিত।
সার্বিক তত্ত্বাবধানে রয়েল টেকনোলজিস