Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Управление плагинами

Эта страница помечена как незавершённая. Вы можете помочь проекту, дополнив её.

WordPress Plugins are composed of PHP scripts that extend the functionality of WordPress. They offer new additions to your blog that either enhance features that were already available or add otherwise unavailable new features to your site.

The majority of WordPress users don't require Plugins, or only require a few, such as Plugins dealing with comment spam or customized post listings. Other users enjoy the varied options Plugins provide such as frequently updated weather reports, post word counts, rating systems, and more. WordPress Plugins are optional, based upon the needs of the user, and thus they are not incorporated into the core of WordPress.

Plugins available via the WordPress Plugins Directory site are designed by volunteers and are usually free to the public. WordPress Plugins hosted in the WordPress Plugins Directory are considered thoroughly tested and "safe." Remember, WordPress Plugins are the responsibility of the author and the user, and they are typically works-in-progress as WordPress grows and expands.

If you want to develop your own Plugins, there is a comprehensive list of resources at Plugin Resources.

Finding Plugins

You can find WordPress Plugins in the Administration Screens > Plugins > Add New screen, or directly via the WordPress Plugins Directory.

Plugin Compatibility and Updates

Check the WordPress Plugin listing on the Plugins List on your WordPress site, or on the WordPress Plugins Directory to determine compatibility and if updates are available.

If a WordPress Plugin update is available, it will be shown on the Dashboard screen, an alert on the Plugin's menu title, and on the Plugin List. Follow the instructions to update the Plugin.

If a WordPress Plugin is not compatible or updated for the next release of WordPress, contact the Plugin author directly for information on the next update and compatibility issues.

Установка плагинов

Автоматическая установка плагинов

Меню плагинов WordPress
Чтобы добавить WordPress плагин используя встроенный установщик плагинов:
  1. Перейдите в админ-панели в Плагины > Добавить новый.
  2. Введите имя плагина или описывающее слово, автора, или тег в окне Поиск плагинов или кликните на ссылку ниже.
  3. Найдите плагин, который вы желаете установить.
    1. Нажмите Детали для получения дополнительной информации о плагине.
    2. Нажмите Установить чтобы установить плагин.
  4. В результате на экране установки появится сообщение об успешном завершении установки или о любых проблемах во время установки.
  5. Если установка завершилась успешно, кликните Активировать, если желаете активировать плагин.


Некоторые плагины WordPress требует шаги чтобы настроить их. ReadMe файл в Детали должен содержать пошаговую инструкцию. После установки, эта информация доступна на экране плагинов для каждого плагина. Если у вас есть проблемы с плагином, смотрите Troubleshooting section.

Для информации как установить WordPress плагин вручную, смотрите наш гайд ручной установки ниже.

Ручная установка плагинов

Есть несколько случаев когда ручная установка WordPress плагинов уместна:

  • Если вы хотите контролировать расположение и процесс установки плагина WordPress.
  • Если ваш сервер не позволяет осуществлять автоматическую установку плагинов WordPress.
  • Плагин находится не в директории плагинов WordPress.

Установка плагинов WordPress вручную требует знакомства с FTP и осознания, что вы подвергаете ваш сайт риску, если устанавливаете плагин несовместимый с текущей версией WordPress или с ненадежного источника.

Сделайте бекап вашего сайта перед продолжением.

Чтобы установить плагин вручную:

  1. Загрузите WordPress плагин на ваш компьютер.
  2. Если загружен zip архив, распакуйте папку плагина на ваш компьютер.
  3. Внимательно прочитайте файл "readme", чтобы убедиться, что вы следуете инструкциям по установке.
  4. С помощью FTP программы загрузите папку плагина в папкуwp-content/plugins в директории с WordPress.
  5. Перейдите в админ-панели WordPress в раздел Плагины > Установленные и найдите только что загруженный плагин.
  6. Нажмите Активировать для активации плагина.

Нажмите на Детали, чтобы просмотреть readmi файл плагина с возможными советами и инструкциями.

Plugin Favorites

The ability to favorite a plugin was added to the WordPress Plugins Directory in 2012. WordPress Version 3.5 introduced the ability to display and easily install a user's favorite plugins from the Add New plugins page of the dashboard.

WordPress Plugins Directory

A favorite plugin in WordPress Plugins Directory
To favorite a plugin:
  1. You must be logged in to the WordPress Plugins Directory
  2. While you are viewing a plugin's page, click the Favorite link below the plugin's download button.

Once you have favorited a plugin, it will show up in your public profile, as well as your rating of the plugin, if applicable.

Installing Favorite Plugins

Viewing a user's favorite plugins in the dashboard
To install plugins from a user's list of favorites within the WordPress dashboard:
  1. Go to Plugins > Add New.
  2. Under Favorites, type in the WordPress.org username of the user who's favorites you would like to install and click Get Favorites.
  3. Follow the Installing Plugins above to install the plugins you would like.

Troubleshooting

Occasionally, a WordPress Plugin may not work as expected, or at all, or conflict with another WordPress Plugin.

  1. Check you've followed the instructions included with the WordPress Plugin exactly.
  2. Check that the Plugin has been activated in your Plugin Screen of your Administration Screens.
  3. Deactivate and re-activate the Plugin to see if this makes it work.
  4. Search the WordPress Support Forums for the name of the Plugin and keywords associated with the problem you are experiencing.
  5. Check the WordPress Plugins Directory for the notes on the Plugin and links to issues reported in the Forums.
  6. Go to the website of the Plugin author and check their blog and Plugin page for known issues or advice.
  7. Search the web with the name of the Plugin and keywords associated with the trouble.
  8. Post a question on the WordPress Support Forums with the name of the Plugin and specific problems in the title. For advice on how to improve your chances of getting help, see Finding WordPress Help.
  9. If the problem persists and you cannot seem to solve it, check to see if there are any similar WordPress Plugins that you can try instead.
  10. Try the following tips below for troubleshooting the problem yourself if you have no fear of going "under the hood."

Advanced Troubleshootings

If you are experiencing problems with a Plugin you installed or one that stopped working after upgrades, the following are the steps you need to take to troubleshoot the Plugin:

  1. If you manually installed the Plugin, use your FTP program to delete the Plugin folder/files and upload it again.
  2. If you made changes to the WordPress Theme template files to add the Plugin's code or customization, make sure they are correct, spelled right (including letter case), and placed in the appropriate place, e.g., within the WordPress Loop or outside of it.
  3. Check that you uploaded the file to the Plugins folder under wp-content. If you are uploading a new version to replace the old, delete the old version prior to uploading the new one.
  4. If the Plugin does not appear in the Plugins List, view the Plugin's main file in the Plugin Editor to ensure the Plugin's header text exists and is properly formed.
  5. If you're using a custom WordPress Theme, try using one of the default WordPress Themes to see if your issue is Theme related. If it is, contact the Theme developer for assistance.
  6. Deactivate all your Plugins to ensure they're not causing the problem. Reactivate the problematic one. If it works, there may be a conflict. Activate the others one-by-one and test the site to see if the problem ceases or returns, which may indicate the conflicting plugin.

Uninstalling Plugins

To uninstall a WordPress Plugin:

  1. Go to Plugins screen.
  2. Find the Plugin you wish to deactivate and uninstall.
  3. Click Deactivate.

The Plugin will initiate the deactivation.

Most WordPress Plugins have an option to completely uninstall themselves, though not all. If you wish to remove a WordPress Plugin permanently:

  1. Check the WordPress Plugin instructions in the Details readme file on how to properly uninstall the Plugin.
  2. If the WordPress Plugin required the addition of code to the WordPress Theme, manually edit the Theme files to remove it.
  3. Deactivate the Plugin and remove it manually through your FTP program.
    1. Login to the site via your FTP Program.
    2. Go to the WordPress Plugins Directory and find where the Plugin is installed.
    3. Delete the WordPress Plugin folder and/or files from your server.

WordPress Plugin Tips

The following are WordPress Plugin tips and techniques for advanced users and developers.

Plugin Management

Plugins are managed from the Plugins Screen in the Administration Screens of your WordPress site. All Plugins listed on this screen are found in your wp-content/plugins directory. Each Plugin has a description in its header section of what it does, an author and website to refer to, and a version number. If you do not see the Plugin in the list of installed Plugins, most likely it is missing the "File Header":

<?php
/*
Plugin Name: Magic Plugin
Plugin URI: http://example.com/magic-plugin
Description: Magic Plugin performs magic
Version: 2.3
Author: Mr. Magic
Author URI: http://example.com/
*/

The header section defines:

Plugin Name 
Shows the Plugin's name, and links to the Plugin's website if one is provided. Plugins listed in bold are currently active.
Version 
The version number of the Plugin.
Description 
The author's description of what the Plugin does and who authored the Plugin.
Action 
Allows you to activate, deactivate, or edit the Plugin.
New version available 
If a newer version of a Plugin is available in the WordPress Plugins Directory a message will display along with a link to the location to download that new version.

Theme Changes

Most WordPress Plugins no longer require direct modification to a WordPress Theme. If you are using a WordPress Plugin that does require direct modification, you need to know:

  1. Updates to the WordPress Theme may remove the Plugin modification code. Use a Child Theme or make notes to remind yourself to re-add the Plugin code to the updated Theme.
  2. If you change Themes, these changes will not carry over automatically to the new Theme. You will need to copy or add them manually to the new WordPress Theme, even if you use a Child Theme as the Child Theme is not associated with the new Theme.
  3. Upgrading WordPress may make changes to the code which could conflict with your WordPress Theme modifications. Use a Child Theme or manually check the Plugin's code to ensure it is still active.

Must-Use Plugins

If you are using the Multisite version of WordPress, Must Use Plugins are special WordPress Plugins installed in a special directory next to the normal /plugins/ dir (/mu-plugins/). They are 'must-use' because once their file is placed in the /mu-plugins/ directory they are instantly activated and cannot be de-activated using the Plugins Screen.

Must-use Plugins are useful for installing WordPress Plugins on all sites in a Multisite installation to make WordPress Plugins' functionalities available across the entire blog network. They are loaded before normal Plugins by PHP, which means that code and hooked-functions registered in a must-use Plugin can be assumed available to all other Plugins.

See Must Use Plugins and Create A Network for more details.

Hiding Plugins When Deactivated

When activated, some WordPress Plugins add tags to the template files. Upon such a Plugin's deactivation, these tags may remain in place and can affect the look and/or functionality of the Theme, resulting in errors or even failures to load. It is therefore imperative to prevent the Plugin from being detected and used, if it is deactivated.

To determine if such a condition exists, you can add some php code to the template file where the Plugin was used, and perform a simple function_exists() check. To do so, add the code in the example below and configure it for the function you'd like to check. Then upload the modified template to your WordPress Content folder.

The if (function_exists()) checks for the Plugin, and if it exists (activated or not), it will use it. If it returns FALSE or "not found", it will ignore the Plugin tag and continue loading the page.

<?php
if (function_exists('FUNCTION NAME')) {
 FUNCTION_NAME();
}
?>

This example Plugin uses a function called alex_get_shoutbox() to print out its contents.

<?php
if (function_exists('alex_get_shoutbox')) {
 alex_get_shoutbox();
}
?>

Developing Plugins

Once you start using WordPress Plugins, you sometimes wonder how you ever got along without them. If you have knowledge of PHP, you can develop your own Plugins, and there is a comprehensive list of resources at Plugin Resources to get you started.