background preloader

Function Reference

Function Reference
Languages: English • Español • فارسی • Français • Italiano • 日本語 ქართული • 한국어 • Português do Brasil • Русский • Türkçe • עברית • 中文(简体) • 中文(繁體) • (Add your language) The files of WordPress define many useful PHP functions. Some of the functions, known as Template Tags, are defined especially for use in WordPress Themes. Many of the core WordPress functions are useful to Plugin and Theme developers. You can help make this page more complete! Here are some things you can do to help: Add documentation to un-documented functions, by creating sub-pages or at least by adding short comments in the lists below. Read Contributing to WordPress to find out more about how you can contribute to the effort! Functions by category Official and Unofficial References Trac Browser - WordPress source code.

Developer Documentation Developer Documentation Languages: English • Español • Italiano • 한국어 • Русский • 中文(繁體) • (Add your language) Introduction WordPress is fast, lightweight, and easy to use. You may also wish to consult the Developer Documentation FAQ. WARNING: Programming Code Ahead The following articles may use programming terms without offering detailed explanations for non-programmers. Although the alteration of the downloadable files for WordPress is limited to a few distinct programmers, every WordPress user has the ability to effect change in the core WordPress code, making WordPress highly customizable. Plugin Development Writing a Plugin - The best starting place for learning about how to develop plugins WordPress Coding Standards - General information about coding standards for WordPress development Debugging in WordPress - Reference and guide for using the built-in debugging system in WordPress. APIs Contributing to WordPress Forums, Lists, and Blogs Other Information of Interest External Resources

Theme Development Languages: বাংলা • English • Español • 日本語 한국어 • Português do Brasil • Русский • 中文(简体) • 中文(繁體) • (Add your language) This article is about developing WordPress Themes. If you wish to learn more about how to install and use Themes, review Using Themes. Why WordPress Themes WordPress Themes are files that work together to create the design and functionality of a WordPress site. You may wish to develop WordPress Themes for your own use, for a client project or to submit to the WordPress Theme Directory. To create a unique look for your WordPress site. A WordPress Theme has many benefits, too. It separates the presentation styles and template files from the system files so the site will upgrade without drastic changes to the visual presentation of the site. Why should you build your own WordPress Theme? It's an opportunity to learn more about CSS, HTML, and PHP. Theme Development Standards WordPress Themes should be coded using the following standards: Anatomy of a Theme Child Themes style.css

Database Description Languages: English • العربية • 日本語 中文(简体) • 한국어 • Русский • (Add your language) The following is an outline and description of the database tables created during the standard installation of WordPress. The database structure and the diagram below were last updated in version 4.4. The only database supported by WordPress is MySQL version 5.0.15 or greater, or any version of MariaDB. Also see prior versions of Database Descriptions for WordPress 1.5, WordPress 2.0, WordPress 2.2, WordPress 2.3, WordPress 2.5, WordPress 2.7, WordPress 2.8, WordPress 2.9, and WordPress 3.3. Because WordPress interfaces with this database by itself, you as an end user, shouldn't have to worry much about its structure. Database Diagram The diagram below provides a visual overview of the WordPress database and the relations between the tables created during the WordPress standard installation. (WP 4.4.2 Database diagram) Table Overview Table Details Indexes Table: wp_links Table: wp_options Table: wp_posts Table: wp_site

Everything about WordPress Configuration (wp-config.php) - Complete WordPress Backup Service Editing configuration files is often considered a daunting task by all of us. We always try our best to avoid modifying the default settings. What if something goes wrong? WordPress installation brings with it about a 1000 files amongst which is the trickiest one – wp-config.php, the WordPress configuration file. Of course, this file can remain untouched if you want to stick to the default settings but it becomes a necessary evil to edit this file to apply security precautions, customize functionality and improve performance. When you install WordPress, the wp-config.php isn’t included. The configuration is most vulnerable to attacks making it imperative for you to secure it in the best possible way. Another important security measure is the file permission. The third step involves modifying the .htaccess file and not the wp-config.php file. # protect wpconfig.php order allow,deny deny from all Database Configuration e.g. define(‘DB_HOST’, ‘localhost:1234′); Security Keys Table Prefix

Roles and Capabilities Roles and Capabilities Languages: English • Español • Français • 日本語 • Português do Brasil • 中文(简体) • (Add your language) Description WordPress uses a concept of Roles, designed to give the site owner the ability to control what users can and cannot do within the site. WordPress has six pre-defined roles: Super Admin, Administrator, Editor, Author, Contributor and Subscriber. The Super Admin role allows a user to perform all possible capabilities. Summary of Roles Super Admin – somebody with access to the site network administration features and all other features. Upon installing WordPress, an Administrator account is automatically created. The default role for new users can be set in Administration Panels > Settings > General. Roles A Role defines a set of tasks a user assigned the role is allowed to perform. The following sections list the default Roles and their capabilities: Super Admin Multisite Super Admins have, by default, all capabilities. Administrator Additional Admin Capabilities

20 Time-Saving WordPress SQL Query Snippets WordPress stores every single scrap of information within a MySQL database. Posts, pages, comments, shortcodes, plugin settings… absolutely everything. The WordPress backend is fantastic, and does allow you to manage and edit everything with ease, but only up to a certain point. Say you have hundreds or even thousands of posts within your database, and you need to make site-wide global changes. Making each edit, via the WordPress Dashboard, can be time-consuming and does open up the possibility of mistakes occurring. Always Backup WordPress First! Your WordPress database stores every single one of your carefully written posts, every comment from your loyal readers and every setting that you have used to personalize your site. Here are some resources to help you backup WordPress: You might also like these useful .htaccess snippets & hacks or these snippets that make WordPress user-friendly for your clients. Useful WordPress SQL Queries Add a Custom Field to All Posts & Pages Source Source

Ultimate Guide to Roles and Capabilities | Gary Cao Since Roles and Capabilities are introduced in WordPress 2.0, the User Level approach has been declared deprecated. However, it’s disappointing that a lot of plugins and themes out there still use user levels to control access to admin option pages and other functionalities. This guide shows you how to properly use Roles and Capabilities in your plugins and themes. Note: This article is a long one, therefore you should probably bookmark it so that you can always come back later for reference. Table of Contents What are Roles and Capabilities? As in other CMS and web applications, WordPress has a built-in system to verify whether a particular user has enough privilege to take a certain action. This system of Roles and Capabilities is much more flexible than User Level, since it enables you to add, remove or reassign capabilities among roles. Capabilities and administration menus As you can see, there’s always a required parameter called capability for each of those functions. WP_Role Class

WordPress hooks database - action and filter hooks for wp plugin developers -- Adam Brown, BYU Political Science What is a hook? In brief, WordPress hooks enable you to change how WordPress behaves without editing any core files. Because you leave the WordPress files untouched, you can painlessly upgrade your blog with each new version of WordPress. It's this hooks architecture that makes WordPress the best blogging solution. If you don't know what WordPress hooks are for, read the Plugin API or this tutorial. What is this directory? If you're a plugin or theme developer, you know how difficult it can be to figure out which hooks are available. What is this good for? See what new hooks are available with each new version of WordPress See which hooks have been deprecated or renamed (use the "view all hooks" option) Easily learn exactly which WP file(s) use each hook. How to help? Update and improve the official action and filter references.

Members Members is a plugin that extends your control over your blog. It's a user, role, and content management plugin that was created to make WordPress a more powerful CMS. The foundation of the plugin is its extensive role and capability management system. Plugin Features: Role Manager: Allows you to edit, create, and delete roles as well as capabilities for these roles.Content Permissions: Gives you control over which users (by role) have access to post content.Shortcodes: Shortcodes to control who has access to content.Widgets: A login form widget and users widget to show in your theme's sidebars.Private Site: You can make your site and its feed completely private if you want. Professional Support If you need professional plugin support from me, the plugin author, you can access the support forums at Theme Hybrid, which is a professional WordPress help/support site where I handle support for all my plugins and themes for a community of 40,000+ users (and growing). Plugin Development Donations

How to build React apps on top of the WordPress REST API UPDATE 06/16/2017:I updated the project to use ReactRouter 4 and Webpack 2. Some parts were refactored and simplified. Included links to the frontend React demo and Wordpress backend demo. WordPress is a powerful content management tool. There’s a light at the end of the tunnel, though! You no longer need to have a local WordPress installation and deal with setting up vhosts. In this article I’m going to use ReactJS to build the front end part of the application, React Router for routing, and Webpack for bundling it all together. The stack looks like this:- ReactJs- React Router v4- Alt (for Flux implementation)- Webpack v2 GitHub repo: frontend demo url: backend demo url: demoPass: wp-react-demo Project setup Let’s name the project “wp-api-react”. Install webpack and webpack-dev-server globally as well if you have not done this already:

Administration Menus Administration Menus Languages: English • 中文(简体) • 日本語 • Русский • (Add your language) Introduction Usually, plugin and theme authors need to provide access to a settings (options) screen so users can customize how the plugin or theme is used. The best way to present the user with such a screen is to create an administration menu item that allows the user to access that settings screen from all the Administration Screens. Function Reference Every Plot Needs a Hook To add an administration menu, you must do three things: Create a function that contains the menu-building code Register the above function using the admin_menu action hook. It is that second step that is often overlooked by new developers. Here is a very simple example of the three steps just described. <? In this example, the function my_plugin_menu() adds a new item to the Settings administration menu via the add_options_page() function. These processes are described in more detail in the sections below. Dashboard Posts Media Links

WP Todolist - Développer une extension WordPress avec la POO - Partie 2 - GeekPress Dans une première partie, nous avons démarré une extension WordPress basée sur de la POO : WP Todolist. Nous avons créé notre premier custom post type afin de gérer nos todo. Cependant, une todo à différentes caractéristiques comme le fait d’avoir différents états (terminé, en cours, important, … ). Comment orienter notre développement pour répondre à ce besoin en programmation orientée objet ? Actuellement, nous avons une todolist où l’on ne peut créer que des todo sans rien pouvoir en faire. Pourquoi le choix de la taxonomy ? Une taxonomy est une relation de type ManyToMany. Pourquoi ne pas choisir une meta donnée ? Une meta donnée dans WordPress est une relation de type OneToOne avec notre custom post type. Je vais commencer par créer ma class Taxonomy que je vais nommer State. Cette class n’a rien d’extraordinaire. <? Il nous reste à instancier notre class State (qu’il faut voir comme un service) lors de la création de nos actions. <? Faisons une code review ! Oui ! <? <? <? Que faire ?

Advanced WordPress Database HTTPS Search + Replace with WP-CLI • When migrating your WordPress site to https you can have leftover http references. Despite using a migration tool or some plugin, they don’t catch all the http references which can cause mixed content errors errors and insecure content warnings. I do migrations often via Codeable and try to use Kinsta or Cloudways whenever possible since they offer WP-CLI. Be sure to check out the in-depth checklist for migrating from HTTP to HTTPS on Kinsta. Finding Occurences Take a backup first, it is super easy, this way if you mess anything up you can re-import and start over. wp db export backup-before-search-replace.sql We can simulate a dry run with using the --dry-run flag it will count the amount of times it finds the string wp search-replace '' '' --dry-run You will get a summary showing how many database replacements will be made To perform the actual search and replace in the WordPress database wp search-replace '' '' URL Encoded