Добавить колонку «Товары» в страницу с заказами

add_filter('manage_edit-shop_order_columns', 'misha_order_items_column' );
function misha_order_items_column( $order_columns ) {
    $order_columns['order_products'] = "Purchased products";
    return $order_columns;
}

add_action( 'manage_shop_order_posts_custom_column' , 'misha_order_items_column_cnt' );
function misha_order_items_column_cnt( $colname ) {
	global $the_order; // the global order object

 	if( $colname == 'order_products' ) {

		// get items from the order global object
		$order_items = $the_order->get_items();

		if ( !is_wp_error( $order_items ) ) {
			foreach( $order_items as $order_item ) {

 				echo $order_item['quantity'] .'&nbsp;&times;&nbsp;<a href="' . admin_url('post.php?post=' . $order_item['product_id'] . '&action=edit' ) . '">'. $order_item['name'] .'</a><br />';
				// you can also use $order_item->variation_id parameter
				// by the way, $order_item['name'] will display variation name too

			}
		}
		
	}

}

Обновить префиксы таблиц wp

На момент, когда у меня возникла необходимость для повышения степени безопасности сайта изменить префиксы таблиц  плагин который указывался в большинстве статей change-db-prefix просто ложил сайт, приходилось восстанавливать.

Рабочим оказался плагин Brozzme DB PREFIX

.htpasswd для wp-admin на apache

Хорошо описано тут

.wpbeginner.com/wp-tutorials/how-to-password-protect-your-wordpress-admin-wp-admin-directory/

Если все равно остается ошибка циклической переадресации, попробуй настроить как на сервере bindital

Закрыть wp-admin с помощью .htpasswd на ngnix

Для начала необходимо сделать .htpasswd файл. Сгенерировать его можно с помощью сервиса hostingcanada.org/htpasswd-generator/

Затем файл необходимо разместить в директории сайта, путь будет указан в коде ниже

location ^~ /wp-admin/ {
        auth_basic "Unauthorized";
        auth_basic_user_file /var/www/www-root/data/www/site.name/.htpasswd;     
        try_files $uri $uri/ /index.php?$args;
location ~ [^/]\.ph(p\d*|tml)$ {
       try_files /does_not_exists @php;         
    }               
           }
           
    location ^~ /wp-admin/admin-ajax.php {
                # This is cool because no php is touched for static content.
                # include the "?$args" part so non-default permalinks doesn't break when using query string
                try_files $uri $uri/ /index.php?$args;
 location ~ [^/]\.ph(p\d*|tml)$ {
      try_files /does_not_exists @php;
    }
        }     
        
    location ^~ /wp-admin/js/password-strength-meter.min.js {
                # This is cool because no php is touched for static content.
                # include the "?$args" part so non-default permalinks doesn't break when using query string
                try_files $uri $uri/ /index.php?$args;
 location ~ [^/]\.ph(p\d*|tml)$ {
      try_files /does_not_exists @php;
    }
        }

woocommerce определение страны пользователя

Для определения кода страны пользователя смотрящего сайт

$location = WC_Geolocation::geolocate_ip();
$country = $location['country'];

Для определения страны пользователя оставившего отзыв

$location = WC_Geolocation::geolocate_ip(get_comment_author_IP());
$country = $location['country'];

Далее получив код страны, например, ‘US’ можно вставлять соответствующий флаг либо выводить необходимую строку с названием страны.

Редактор wp удаляет p теги. Что делать.

Для того, чтобы редкатор вордпресс не удалял теги параграфа и переноса необходимо установить плагин  Advanced Editor Tools и в нем активировать опцию «Stop removing the <p> and <br /> tags when saving and show them in the Text editor«

Где хранятся логи ispmanager

Иногда в ispmanager при настройке сервера забывают снять галочки «Вести учет  доступов и ошибок» из за чего на сервере просто заканчивается свободное место. Его полностью занимают логи. Чтобы их очистить нужно подключиться к серверу по sftp перейти в указанную папке у удалить файлы.

usr/local/mgr5/var/logs/

woocommerce вывод отзывов на главной

Если необходимо вывести  определенное количество отзывов в определенном месте шаблона или на определенной странице, то можно воспользоваться следующим кодом:

function get_woo_reviews()
{
    $comments = get_comments(
        array(
            'status'      => 'approve',
            'post_status' => 'publish',
            'post_type'   => 'product',
        )
    ); 
    shuffle($comments);
    $comments = array_slice( $comments, 0, 5 );
    $html = '<ul>';
    foreach( $comments as $comment ) :
        $html .= '<li><h2>'.get_the_title( $comment->comment_post_ID ).'</h2>';
        $html .= '<p>' .$comment->comment_content.'</p>';
        $html .= "<p>Posted By :".$comment->comment_author." On ".$comment->comment_date. "</p></li>";
    endforeach;
    $html .= '</ul>';
    ob_start();
    echo $html;
        $html = ob_get_contents();
    ob_end_clean();

    return $html;
}
add_shortcode('woo_reviews', 'get_woo_reviews');

И потом использовать:

echo do_shortcode( "[woo_reviews]" );

 

.htacces кэшировать шрифты

<IfModule mod_expires.c>
  Header set cache-control: public
  ExpiresActive on

  ExpiresByType font/ttf      "access plus 1 month"
  ExpiresByType font/woff     "access plus 1 month"
  ExpiresByType font/woff2     "access plus 1 month"
  ExpiresByType image/svg+xml "access plus 1 month"
</IfModule>

<IfModule mod_deflate.c>
  <FilesMatch "\.(ttf|otf|eot|svg)$" >
    SetOutputFilter DEFLATE
  </FilesMatch>
</IfModule>