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 с одного домена на другой? ====
Через [[https://interconnectit.com/products/search-and-replace-for-wordpress-databases/|Search Replace DB]], [[https://github.com/interconnectit/Search-Replace-DB|github]].
==== Мини-статистика ram/sql/time ====
==== Мини-статистика ram/sql/time #2 ====
В стиле LiveInternet
Generated by:
Queries:
Memory:
==== Проверка работы почты ====
Файл в корневой директории WP
==== 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";
[[https://stackoverflow.com/questions/535020/tracking-the-script-execution-time-in-php|via]]
==== Отключить превью для ссылок twitter в постах ====
https://wordpress.org/support/article/embeds/
Через [[https://wordpress.org/plugins/disable-embeds/|плагин]], через [[https://developer.wordpress.org/reference/functions/wp_oembed_remove_provider/|код]]
==== Пересоздание миниатюр ====
Печальная новость. Автор плагина [[https://ru.wordpress.org/plugins/regenerate-thumbnails/|Regenerate Thumbnails]] Viper007Bond Alex Mills после долгой борьбы с болезнью ныне RIP.
Вероятно [[https://developer.wordpress.com/2019/06/06/taking-care-of-alexs-plugins/|сообщество Wordpress]] позаботится о коде.
Альтернативно для работы с миниатюрами [[https://developer.wordpress.org/cli/commands/media/regenerate/|можно использовать 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
==== Убрать ограничение 2560 px для загружаемых изображений ====
Через [[https://wordpress.org/plugins/disable-big-image-threshold/|плагин]]
code snippet [[https://wordpress.org/plugins/code-snippets/|плагин]]
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);
{{tag>wordpress cms}}