RTFM.WIKI

Ordnung muß sein. Ordnung über alles (18+)

Инструменты пользователя

Инструменты сайта


web:wordpress:wordpress_links

CMS: WordPress

Хомпэйдж, доки, лалала


GoD Bless

Спасибо следующим статьям, которые сэкономили мне много времени.

Шаблоны

Хаки спамы куки

Плагины

Yoast

Разное

Запрет выполнения кода

Options -Indexes
php_flag engine 0
RemoveHandler .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml
AddType application/x-httpd-php-source .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml

Как перенести сайт WP с одного домена на другой?

Через Search Replace DB, github.

Мини-статистика ram/sql/time

<?php
echo "Статистика:" . get_num_queries() . "/ "; timer_stop(1);
echo "s/ ". round(memory_get_usage()/1024/1024, 2) . " MB ";
?>

Мини-статистика ram/sql/time #2

В стиле LiveInternet

<!-- WORDPRESS STATISTICS -->
 <div style="line-height: 10px; display: block; text-align: left; font-family: Tahoma; width: 88px; height:31px; border: 0px; background: #e7e7e7; font-size: 7pt;">
 <span style="color: #555555;">Generated by:</span> <?php timer_stop(1); ?>
 <span style="color: #555555;">Queries:</span> <?php echo get_num_queries(); ?>
 <span style="color: #555555;">Memory:</span> <?php if (function_exists('memory_get_usage')) echo round(memory_get_usage()/1024/1024, 2) . 'MB '; ?>
 </div>
<!-- /WORDPRESS STATISTICS -->

Проверка работы почты

Файл в корневой директории WP

<?php
 
        // Set $to as the email you want to send the test to.
 
$to = "you@yourdomain.com" ;
 
       // No need to make changes below this line.
       // Email subject and body text.
 
$subject = ' wp_mail function test ' ;
$message = ' This is a test of the wp_mail function: wp_mail is working ' ;
$headers = '' ;
 
      // Load WP components, no themes.
 
define ('WP_USE_THEMES', false);
 
require('wp-load.php');
 
     // send test message using wp_mail function.
 
$sent_message = wp_mail( $to, $subject, $message, $headers);
 
     //display message based on the result.
 
if ( $sent_message ) {
 
    // The message was sent.
echo 'The test message was sent. Check your email inbox.' ;
 
} else {
 
    // The message was not sent.
echo 'The message was not sent!' ;
}

htaccess по-умолчанию

# BEGIN WordPress Permalinks
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress Permalinks

Лимит памяти для Wordpress

Для wp-admin

define('WP_MAX_MEMORY_LIMIT', '1024M');

Для frontend

define('WP_MEMORY_LIMIT', '512M');

Еще один пример time used

// Script start
$rustart = getrusage();

// Code ...

// Script end
function rutime($ru, $rus, $index) {
    return ($ru["ru_$index.tv_sec"]*1000 + intval($ru["ru_$index.tv_usec"]/1000))
     -  ($rus["ru_$index.tv_sec"]*1000 + intval($rus["ru_$index.tv_usec"]/1000));
}

$ru = getrusage();
echo "This process used " . rutime($ru, $rustart, "utime") .
    " ms for its computations\n";
echo "It spent " . rutime($ru, $rustart, "stime") .
    " ms in system calls\n";

via

Отключить превью для ссылок twitter в постах

Пересоздание миниатюр

Печальная новость. Автор плагина Regenerate Thumbnails Viper007Bond Alex Mills после долгой борьбы с болезнью ныне RIP.

Вероятно сообщество Wordpress позаботится о коде.

Альтернативно для работы с миниатюрами можно использовать wp-cli.

undefined function trailingslashit()

Fatal error: Uncaught Error: Call to undefined function trailingslashit() in /var/www/rtfm/data/www/foobar.com/wp-includes/class-wp-textdomain-registry.php:103
...

установить php-psr

Удалить Woocommerce

Добавить в файл wp-config.php

define( 'WC_REMOVE_ALL_DATA', true );

Деактивировать плагин, удалить плагин, все таблицы WC будут удалены.

Источник: Installing and Uninstalling WooCommerce

Убрать ограничение 2560 px для загружаемых изображений

Через плагин

code snippet плагин

<?php
// Disable WordPress' automatic image scaling feature
add_filter( 'big_image_size_threshold', '__return_false' );

functions.php

add_filter( 'big_image_size_threshold', '__return_false' );

изменить размер

function custom_image_threshold( $threshold ) {
   return 4000; // new threshold
}
add_filter('big_image_size_threshold', 'custom_image_threshold', 999, 1);
Сайт rtfm.wiki использует cookies и трекинг посещений. Продолжая использовать этот сайт, вы соглашаетесь с сохранением файлов cookie на вашем компьютере. Если вы не согласны покиньте сайт или включите Adblock 😎 Что такое cookies? 🍪

Обсуждение

Ваш комментарий. Вики-синтаксис разрешён:
 
web/wordpress/wordpress_links.txt · Последнее изменение: 2023/10/25 18:22 — dx