Návrat WordPressu do výchozího nastavení

**Advanced WordPress Reset**
„https://wordpress.org/plugins/advanced-wp-reset/“:https://wordpress.org/plugins/advanced-wp-reset/

Plugin will reset you WordPress Database back to its first original status in order to make a fresh installation without going through WordPress traditional installation. This plugin will help you saving time especially if you are a developer and you have to install WordPress from scratch each time.

– Resets the database without deleting or modifying any of your files (all your WordPress, plugins and themes files are kept)
– Deletes all database customizations made by plugins and themes.
– Deletes all content including post, pages, options, etc.
– Detects the Admin user and recreate it with its saved password
– Keeps the blog name after the reset

**WordPress Database Reset**
„https://wordpress.org/plugins/wordpress-database-reset/“:https://wordpress.org/plugins/wordpress-database-reset/

The WordPress Database Reset plugin allows you to reset the database back to its default settings without having to go through the WordPress 5 minute installation.

– Extremely fast one click process to reset the WordPress database
– Choose to reset the entire database or specific database tables
– Secure and super simple to use
– Prefer the command line? Reset the database in one command
– Excellent for theme and plugin developers who need to clean the database of any unnecessary content

Instantní WordPress pro testování

„Instant WordPress“:http://www.instantwp.com/ is a complete **standalone, portable WordPress development environment** that can even run from a USB drive. It’s easy enough for anyone to use – developers and non-developers alike. „Instant WordPress“:http://www.instantwp.com/ is entirely free and made for WordPress, so you don’t need to set up a database and install each time you want to create a new development site. „Instant WordPress“:http://www.instantwp.com/ is spyware and adware free.

– Do you get frustrated testing your WordPress themes and plugins for each new WordPress upgrade?
– Would you like to be able to easily and quickly test a WordPress theme or plugin?
– Would you like to carry around your WordPress testing and development work on a USB key?

Trvalé odkazy v lokální instalaci XAMP

V lokální instalaci Apache obvykle defaultně nefunguje *mod_rewrite*, tj. obsah *.htaccess* je ignorován, a nastavíte-li si pak user-friendly odkazy např. pomocí /%postname%/, vrací se stránky/příspěvky jako nenalezené s kódem 404.

Napravit to lze změnou v souboru *httpd.conf*, který se nalézá v lokálním adresáři XAMPu *\apache\conf*.

Řádek

/—code php
#LoadModule rewrite_module modules/mod_rewrite.so
\—

stačí odkomentovat (vymazat znak *#*).

Dále je třeba zkonreolovat, zda v části

/—code php
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be „All“, „None“, or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
\—

není zakomentována direktiva *AllowOverride All* (a je v tomto znění).

Po uložení *httpd.conf* a restartu lokálního Apache již WordPress odkazy přepisuje.

Automatizace instalace a konfigurace

**Core Tweaks WordPress Setup**
„http://wordpress.org/extend/plugins/seo-automatic-wp-core-tweaks/“:http://wordpress.org/extend/plugins/seo-automatic-wp-core-tweaks/

This plug-in completely automates the proper setup of your WordPress blog for search engine optimization. Primarily for use in new WP installations.
Almost everything is covered, from changing the permalink structure to deleting the Hello World sample post and comment. All the options are accessible from one single page.

*Související:*
„Hromadná instalace pluginů“:https://wordpresso.ovx.cz/hromadna-instalace-pluginu/

*Další informace k automatické instalaci a konfiguraci:*

„http://wpbits.wordpress.com/2007/08/09/automating-wordpress-customizations-the-plugin-way/“:http://wpbits.wordpress.com/2007/08/09/automating-wordpress-customizations-the-plugin-way/
„http://wpbits.wordpress.com/2007/08/10/automating-wordpress-customizations-the-installphp-way/“:http://wpbits.wordpress.com/2007/08/10/automating-wordpress-customizations-the-installphp-way/

Konfigurace

Wp-config.php is the single most important file in your entire WordPress installation. This file can be used to configure database functionalities, enhance performance, and improve security on all WordPress powered websites and blogs.

**Debugging WordPress**

For developers, WordPress has this awesome debugging feature which allows them to find errors, and deprecated functions. By default, this function is set to false, but in the development mode, developers should have it enabled.

/—code php
define(‚WP_DEBUG‘, false); // disable debugging mode by default
define(‚WP_DEBUG‘, true); // enable debugging mode
\—

**Blog/Site Address**

In your WordPress Settings, you specify the WordPress address and the site address. Those are added in your database, and every time the developer calls it in the template, it is running a database query. In WordPress 2.2, these two settings were introduced to override the database values without changing them:

/—code php
define(‚WP_HOME‘, ‚http://www.wpbeginner.com‘);
define(‚WP_SITEURL‘, ‚http://www.wpbeginner.com‘);
\—

By adding these in your wp-config.php, you are reducing the number of database queries thus increasing your site’s performance.

**Override File Permissions**

You can override file permissions, if your host has restrictive permissions for all user files. Most of you do not need this, but it exists for those who need it.

/—code php
define(‚FS_CHMOD_FILE‘, 0755);
define(‚FS_CHMOD_DIR‘, 0644);
\—

**Post Revisions**

In the recent versions of WordPress, there is a super awesome feature called Post Revisions. This function auto-saves posts just incase if your browser crash, or something else happen. It also allows users to restore back to previous versions if they don’t like the changes and so on. While a lot of us love this feature, some of us really hate it with a passion. This function has numerous configuration, so you can make it work just right for you.
By default WordPress saves post every 60 seconds, but if you think that is way too much, then you can modify it to your likings with this configuration:

/—code php
define(‚AUTOSAVE_INTERVAL‘, 120); // in seconds
\—

Some posts have 10s, 20s, or even 100 post revisions depending on the blog owner. If you think that feature annoys you, then you can limit the number of revisions per post.

/—code php
define(‚WP_POST_REVISIONS‘, 5);
\—

You can use any integer you like there.

If none of the settings above satisfies you, then you can simply disable the post revisions feature by adding this function:

/—code php
define(‚WP_POST_REVISIONS‘, false);
\—

**WordPress Trash Feature**

In WordPress 2.9, there was a new “Trash” feature added to the core. This feature works just like the recycling bin, so instead of deleting the post permanently, you would send it to the trash. This helped those users who accidently click on Delete button, and it can be any of us. The bad part about this trash feature is that you have to empty the trash regularly. By default the trash empties itself every 30 days. You can modify that by using the following function:

/—code php
define(‚EMPTY_TRASH_DAYS‘, 7 ); //Integer is the amount of days
\—

**FTP/SSH Constants**

By default, WordPress allow you to upgrade plugins, and WordPress core versions from within the backend. There are some hosts that requires an FTP or SSH connection everytime you try to upgrade, or install a new plugin. By using the codes below, you can set the FTP or SSH constants and never have to worry about it again.

/—code php
// forces the filesystem method: „direct“, „ssh“, „ftpext“, or „ftpsockets“
define(‚FS_METHOD‘, ‚ftpext‘);
// absolute path to root installation directory
define(‚FTP_BASE‘, ‚/path/to/wordpress/‘);
// absolute path to „wp-content“ directory
define(‚FTP_CONTENT_DIR‘, ‚/path/to/wordpress/wp-content/‘);
// absolute path to „wp-plugins“ directory
define(‚FTP_PLUGIN_DIR ‚, ‚/path/to/wordpress/wp-content/plugins/‘);
// absolute path to your SSH public key
define(‚FTP_PUBKEY‘, ‚/home/username/.ssh/id_rsa.pub‘);
// absolute path to your SSH private key
define(‚FTP_PRIVKEY‘, ‚/home/username/.ssh/id_rsa‘);
// either your FTP or SSH username
define(‚FTP_USER‘, ‚username‘);
// password for FTP_USER username
define(‚FTP_PASS‘, ‚password‘);
// hostname:port combo for your SSH/FTP server
define(‚FTP_HOST‘, ‚ftp.example.org:21‘);
\—

**Auto Database Optimization**

In WordPress 2.9, there was a feature added called Automatic Database Optimization. To enable this feature, you would need to use the following function:

/—code php
define(‚WP_ALLOW_REPAIR‘, true);
\—

Once activated, you can see the settings on this page: http://www.yoursite.com/wp-admin/maint/repair.php
The user does not need to be logged in to access this functionality when this define is set. This is because its main intent is to repair a corrupted database, Users can often not login when the database is corrupt. So once you are done repairing and optimizing your database, make sure to remove this from your wp-config.php.

**Increase PHP Memory Limit**

There is a common WordPress Memory Exhausted Error that users have seen when activating some plugin. You can increase the PHP Memory Limit through wp-config.php file. Simply paste the code below:

/—code php
define(‚WP_MEMORY_LIMIT‘, ’64M‘);
\—

Note: This feature may not work with some web hosts.

**WordPress Error Log**

For developers, it is useful to have an error log for a site. You can easily create a simple error log for a WordPress powered website by using wp-config.php file. First create a file called “php_error.log”, make it server-writable, and place it in the directory of your choice. Then edit the path in the third line of the following code:

/—code php
@ini_set(‚log_errors‘,’On‘);
@ini_set(‚display_errors‘,’Off‘);
@ini_set(‚error_log‘,’/home/path/domain/logs/php_error.log‘);
\—

Also, for an error log, you should instead use these constants:

/—code php
define( ‚WP_DEBUG‘, true ); // Enables error reporting.
define( ‚WP_DEBUG_DISPLAY‘, false ); // Hides the errors.
define( ‚WP_DEBUG_LOG‘, true ); // Logs errors to wp-content/error.log (or use @ini_set(‚error_log‘) )
\—

**Automatické vysypání koše**

/—code php
define(‚EMPTY_TRASH_DAYS‘, 30 ); // Vysypání koše po 30 dnech
\—

**Přesunutí složky WP-Content**

/—code php
define( ‚WP_CONTENT_DIR‘, $_SERVER[‚DOCUMENT_ROOT‘] . ‚/newlocation/wp-content‘ );
\—

nebo

/—code php
define( ‚WP_CONTENT_URL‘, ‚http://www.yourwebsite.com/newlocation/wp-content‘ );
\—

cesta k adresáři s pluginy

/—code php
define( ‚WP_PLUGIN_DIR‘, $_SERVER[‚DOCUMENT_ROOT‘] . ‚/newlocation/wp-content/plugins‘ );
define( ‚WP_PLUGIN_URL‘, ‚http://www.yourwebsite.com/newlocation/wp-content/plugins‘);
\—

**Pokud nefunguje localhost a neznáme jméno DB serveru**

/—code php
define(‚DB_HOST‘, $_ENV{DATABASE_SERVER});
\—

/—code php
define(‚DB_HOST‘, $_ENV{DATABASE_SERVER});
\—

Nezapomeňte konfigurační soubor „zabezpečit“:https://wordpresso.ovx.cz/vyladeni-nove-instalace-wordpressu/.

Hromadná instalace pluginů

**Improved Plugin Installation**
„http://wordpress.org/extend/plugins/improved-plugin-installation/“:http://wordpress.org/extend/plugins/improved-plugin-installation/

This plugin is an improvement to the current WordPress plugin installation methods. It allows you to install one or more plugins simply by typing their names or download URLs in a textarea.

The installation form will happily accept any of these inputs:
– http://wordpress.org/extend/plugins/plugin-name/
– http://downloads.wordpress.org/plugin/plugin-name.zip
– http://www.example.com/plugin-name.zip

Stačí tedy nainstalovat pouze tento jediný plugin, a do textarea zkopírovat seznam požadovaných pluginů.

Nastavení počtu revizí a smazání revizí příspěvků

**Delete-Revision**
„http://wordpress.org/extend/plugins/delete-revision/“:http://wordpress.org/extend/plugins/delete-revision/

V *Nastavení > Delete-Revision > Check Redundant Revision* pak lze vymazat zbytečné revize.

**Revision Control**
„http://wordpress.org/extend/plugins/revision-control“:http://wordpress.org/extend/plugins/revision-control

**Optimize Database after Deleting Revisions**
„http://wordpress.org/plugins/rvg-optimize-database/“:http://wordpress.org/plugins/rvg-optimize-database/

One Click WordPress Database Cleaner / Optimizer.

**Řešení bez použití pluginů:**

v souboru wp-config.php možno nastavit
/—code php
// vypne revize
define(‚WP_POST_REVISIONS‘, false );

// ukládá jen definovaný počet revizí
define(‚WP_POST_REVISIONS‘, 2);

// nastaví interval ukládání ve vteřinách
define(‚AUTOSAVE_INTERVAL‘, 60 );
\—

**PHP skript pro hromadné smazání všech revizí :**

/—code php

\—

**Ev. v Myadminu jen SQL příkazem :**

/—code php
DELETE FROM wp_posts WHERE post_type=’revision‘
\—

Vyladění nové instalace WordPressu

**Nastavení .htaccess**

Zabezpeční souboru wp-config.php

/—code php

order allow,deny
deny from all

\—

Adresa vždy bez www

/—code php
RewriteEngine on
Options +FollowSymlinks
RewriteCond %{HTTP_HOST} ^www.domena.cz
RewriteRule (.*) http://domena.cz/$1 [R=301,QSA,L]
\—

Adresa vždy s www

/—code php
RewriteEngine on
Options +FollowSymlinks
RewriteCond %{HTTP_HOST} ^domena.cz
RewriteRule (.*) http://www.domena.cz/$1 [R=301,QSA,L]
\—

Zákaz výpisu obsahu adresářů

/—code php
Options -Indexes
\—

Odstranění „rubriky“ z url

/—code php
RewriteRule ^category/(.+)$ http://www.domena.cz/$1 [R=301,L]
\—

(ev. použijeme plugin „No category base“:45)

**Robots.txt**

Zákaz přístupu do adresářů WordPressu robotům a uvedení odkazu na sitemap

/—code php
User-agent: *
Disallow: /cgi-bin/
Disallow: /wp-admin/
Disallow: /wp-includes/
Disallow: /wp-content/
Disallow: /trackback/
Disallow: /xmlrpc.php
Disallow: /wp-

Sitemap: http://domena.cz/sitemap.xml
\—

Pro vytvoření sitemapy použijeme plugin „Google XML Sitemaps“:219

**Nastavení „user-friendly“ odkazů**

Nastavení > Trvalé odkazy > Vlastní struktura: /%postname%/

**Vytvoření a odkaz na favicon**

1. Vytvoříme *favicon.ico* (např. „zde“:http://www.chami.com/html-kit/services/favicon/ nebo „zde“:http://tools.dynamicdrive.com/favicon/)
3. Zkopírujeme ho do rootu našeho blogu
2. Umístíme do hlavičky v souboru *header.php*

/—code php

Zvýraznění syntaxe kódu v editaci šablon a pluginů

**Power Code Editor**
„http://wordpress.org/extend/plugins/power-code-editor/“:http://wordpress.org/extend/plugins/power-code-editor/
„http://anetech.eu/power-code-editor/“:http://anetech.eu/power-code-editor/

Helps you more effectively edit your themes or plugins when you only have access to a browser, by enabling syntax highlighting in WordPress‘ integrated source code editors. Supports PHP, HTML, CSS and JavaScript.

*Alternativy:*

**WP Code Editor Plus**
„http://wordpress.org/extend/plugins/wp-code-editor-plus/“:http://wordpress.org/extend/plugins/wp-code-editor-plus/

Current Features Include: * Syntax Highlighter * JavaScript Code Completion * Ability to resize editor via click & drag

**HTML Editor Syntax Highlighter**
„http://wordpress.org/extend/plugins/html-editor-syntax-highlighter/screenshots/“:http://wordpress.org/extend/plugins/html-editor-syntax-highlighter/screenshots/

[* http://s.wordpress.org/extend/plugins/html-editor-syntax-highlighter/screenshot-1.png?r=599322 500×261 *]

**WP Editarea**
„http://wordpress.org/extend/plugins/wp-editarea/“:http://wordpress.org/extend/plugins/wp-editarea/
„http://takien.com/606/wp-editarea-wordpress-plugin.php“:http://takien.com/606/wp-editarea-wordpress-plugin.php

Umožňuje editor vypínat a zapínat, v kódu lze vyhledávat a nahrazovat.

Implementováno na tomto webu.

**WP Editor**
„http://wpeditor.net/“:http://wpeditor.net/
„http://wordpress.org/plugins/wp-editor/“:http://wordpress.org/plugins/wp-editor/

WP Editor is a plugin for WordPress that replaces the default plugin and theme editors as well as the page/post editor. Using integrations with CodeMirror and FancyBox to create a feature rich environment, WP Editor completely reworks the default WordPress file editing capabilities. Using Asynchronous Javascript and XML (AJAX) to retrieve files and folders, WP Editor sets a new standard for speed and reliability.