


Submitting patches to WordPress core: the process of creating and sharing changes
If you use WordPress to make a living and tell your story, it’s very exciting to see the changes you write added to the WordPress codebase. I know this is for me.
In this tutorial, you'll learn some of the simple things you need to know to create a WordPress patch that is accepted by the core software.
While WordPress is open source software that anyone can download and modify, only a handful of core contributors are able to commit their changes to WordPress itself. If you want to make a change to WordPress's core files, you can make a suggestion by creating a ticket detailing the proposed change and attaching a patch, or by attaching the patch to an existing ticket.
A patch or diff file is a file that details the changes you have made to your source code and can be used by a version control system such as SVN or GIT to apply your changes. Patches can be easily created from the command line or through GUI tools like SourceTree.
In this article, I will detail how to use the excellent GIT GUI application SourceTree to check for the latest version of WordPress and create a patch file. If you prefer, you can use a GUI tool of your choice or the command line.
Find or create tickets in Core Trac
When you submit a patch to WordPress core, it must be attached to a ticket in the WordPress issue tracker (called trac). Therefore, the first step in submitting a patch is to find or create a ticket.
While it is possible that new tickets with new features will be accepted, it is unlikely. WordPress has millions of users, and it makes sense that major developers would be wary of introducing new features. Almost all new features are now developed separately as plugins first and only merged into the core after extensive testing and development.
The best way to get a patch accepted is to create a patch for an existing ticket. Recently, core trac was redesigned to make it easier to find tickets that have simple fixes and are most likely to be included in the next version and version of WordPress.
Report error
If you want to create a new ticket in core trac (which is a great thing if you find a new bug), you can do that here. Just make sure you search trac for any reports of the same issue before creating a new ticket and verify that the bug exists in the latest version of WordPress.
I am not referring to the latest version, but the master branch in GIT terminology or trunk in SVN terminology. I'll detail how to get the latest version later in this tutorial.
You must at least fill out the Summary field (the title of the ticket) and the Description field, which is the content of the ticket. In your ticket description, be as descriptive as possible.
At the 2013 WordCamp Orlando contributor workshop I attended, WordPress lead developers Mark Jaquith and Andrew Nacin created this list of great bug reports:
- Steps to reproduce the problem (starting with the earliest step)
- wrong description
- What you see versus what you expect
- Error message or error code
- PHP Errors (What are the warnings on the page, what appears in the logs, are there any JavaScript or Apache/nginx errors?)
- What browser?
- Environment (your PHP version, MySQL Apache or nginx version)
- Will this happen without plugin and default theme?
- Screenshots of user interface issues
- Clear and concise
- Let’s get to the topic first, and then explain in detail.
- Related ticket number
- One error per ticket
- Permalink settings
- Do you want to enable multisite?
- WP_DEBUG or equivalent enabled?
- The user role logged in when the problem occurred (or change the role in the database)
Keep in mind that not all of these will be relevant to every error, but the more relevant information you can add, the better.
Unless you are sure what you want to set there, you should leave the fields described below and let core contributors use them to classify tickets accordingly. I recommend using the "Has Patch" or "Needs Patch" tag depending on whether you attach a patch to fix the bug.
View the latest WordPress from GitHub using GUI tools
Before creating a patch for any ticket, it is very important to have the absolutely latest version of WordPress, as many changes are made to it every day. Unless you're using the latest code, it's impossible to know if your fix worked or if the bug still exists. If your patch modifies code that has already been changed, it may not be accepted.
WordPress is managed in SVN, but the code is mirrored as GIT repositories in two locations:
git://core.git.wordpress.org/
- https://github.com/WordPress/WordPress
GitHub repositories are the easiest to use. Keep in mind that even though it's an official GitHub repository, it's still not used for issue tracking, and you shouldn't submit pull requests to it.
There are multiple ways to get the latest version of WordPress via SVN or Git. Personally, I find the easiest way to clone a GitHub image using the excellent GIT GUI tool SourceTree. This is as simple as selecting New/Clone from the File menu, entering the address of your Git repository in the Source Path/URL field, and specifying the local path for the clone, located inside your XAMMP or Vagrant test environment.
Speaking of Vagrant, the popular WordPress Vagrant configuration VVV has a pre-configured test environment for WordPress core, including the latest code and unit tests.
Create patch file
After you have made the changes to WordPress that are required to resolve the issue you are trying to fix and have tested the fix, you will need to create a patch file to upload to a ticket. SourceTree includes a method for creating patch files, or you can use the command line.
In SourceTree, you can create a patch file by going to your working copy and right-clicking on the changed file. Select "Create Patch" from the right-click menu.
Alternatively, navigate to the root of your WordPress repository in the terminal and create a diff using the following command:
git diff —non-prefix ~/name.path
No matter how you create the patch file, you should name it after its target ticket number. If this is the second patch uploaded to the ticket, append .2 to the end of the number, if this is the third, append .3, and so on. For example, the fifth patch for ticket #12358 would be called #12358.5
Upload patches to Trac
Now that your patch is ready, you need to upload it to a ticket in core trac. On any existing ticket, there is an "Attach File" button below the description that you can use to upload a patch. On the next screen, be sure to add a description of what the patch does.
Be patient and understand
WordPress is a massive project, so it's unreasonable to expect an immediate response to your patch. Also, please understand that the standard for patches submitted to WordPress must be very high to best serve all users.
After submitting a patch, please be patient and understanding of any feedback you receive. The main developers are very approachable, if you have questions about a patch or why it's not improved, feel free to ask one of them in the #wordpress-dev IRC channel.
While it can be frustrating to wait for a response and have to make changes, it's worth it when your patch is submitted to WordPress and the changeset description recognizes you.
The above is the detailed content of Submitting patches to WordPress core: the process of creating and sharing changes. For more information, please follow other related articles on the PHP Chinese website!

Yes, WordPress is very suitable for e-commerce. 1) With the WooCommerce plugin, WordPress can quickly become a fully functional online store. 2) Pay attention to performance optimization and security, and regular updates and use of caches and security plug-ins are the key. 3) WordPress provides a wealth of customization options to improve user experience and significantly optimize SEO.

Do you want to connect your website to Yandex Webmaster Tools? Webmaster tools such as Google Search Console, Bing and Yandex can help you optimize your website, monitor traffic, manage robots.txt, check for website errors, and more. In this article, we will share how to add your WordPress website to the Yandex Webmaster Tool to monitor your search engine traffic. What is Yandex? Yandex is a popular search engine based in Russia, similar to Google and Bing. You can excel in Yandex

Do you need to fix HTTP image upload errors in WordPress? This error can be particularly frustrating when you create content in WordPress. This usually happens when you upload images or other files to your CMS using the built-in WordPress media library. In this article, we will show you how to easily fix HTTP image upload errors in WordPress. What is the reason for HTTP errors during WordPress media uploading? When you try to upload files to Wo using WordPress media uploader

Recently, one of our readers reported that the Add Media button on their WordPress site suddenly stopped working. This classic editor problem does not show any errors or warnings, which makes the user unaware why their "Add Media" button does not work. In this article, we will show you how to easily fix the Add Media button in WordPress that doesn't work. What causes WordPress "Add Media" button to stop working? If you are still using the old classic WordPress editor, the Add Media button allows you to insert images, videos, and more into your blog post.

Do you want to know how to use cookies on your WordPress website? Cookies are useful tools for storing temporary information in users’ browsers. You can use this information to enhance the user experience through personalization and behavioral targeting. In this ultimate guide, we will show you how to set, get, and delete WordPresscookies like a professional. Note: This is an advanced tutorial. It requires you to be proficient in HTML, CSS, WordPress websites and PHP. What are cookies? Cookies are created and stored when users visit websites.

Do you see the "429 too many requests" error on your WordPress website? This error message means that the user is sending too many HTTP requests to the server of your website. This error can be very frustrating because it is difficult to find out what causes the error. In this article, we will show you how to easily fix the "WordPress429TooManyRequests" error. What causes too many requests for WordPress429? The most common cause of the "429TooManyRequests" error is that the user, bot, or script attempts to go to the website

WordPresscanhandlelargewebsiteswithcarefulplanningandoptimization.1)Usecachingtoreduceserverload.2)Optimizeyourdatabaseregularly.3)ImplementaCDNtodistributecontent.4)Vetpluginsandthemestoavoidconflicts.5)ConsidermanagedWordPresshostingforenhancedperf

WordPress is very customized, providing a wide range of flexibility and customizability. 1) Through the theme and plug-in ecosystem, 2) use RESTAPI for front-end development, 3) In-depth code level modifications, users can achieve a highly personalized experience. However, customization requires mastering technologies such as PHP, JavaScript, CSS, etc., and pay attention to performance optimization and plug-in selection to avoid potential problems.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.
