Table of Contents
Find or create tickets in Core Trac
Report error
View the latest WordPress from GitHub using GUI tools
Create patch file
Upload patches to Trac
Be patient and understand
Home CMS Tutorial WordPress Submitting patches to WordPress core: the process of creating and sharing changes

Submitting patches to WordPress core: the process of creating and sharing changes

Aug 31, 2023 pm 02:25 PM

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.

向 WordPress 核心提交补丁:创建和共享更改的过程

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:

  1. git://core.git.wordpress.org/
  2. 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.

向 WordPress 核心提交补丁:创建和共享更改的过程

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.

向 WordPress 核心提交补丁:创建和共享更改的过程

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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Is WordPress easy for beginners? Is WordPress easy for beginners? Apr 03, 2025 am 12:02 AM

WordPress is easy for beginners to get started. 1. After logging into the background, the user interface is intuitive and the simple dashboard provides all the necessary function links. 2. Basic operations include creating and editing content. The WYSIWYG editor simplifies content creation. 3. Beginners can expand website functions through plug-ins and themes, and the learning curve exists but can be mastered through practice.

How To Begin A WordPress Blog: A Step-By-Step Guide For Beginners How To Begin A WordPress Blog: A Step-By-Step Guide For Beginners Apr 17, 2025 am 08:25 AM

Blogs are the ideal platform for people to express their opinions, opinions and opinions online. Many newbies are eager to build their own website but are hesitant to worry about technical barriers or cost issues. However, as the platform continues to evolve to meet the capabilities and needs of beginners, it is now starting to become easier than ever. This article will guide you step by step how to build a WordPress blog, from theme selection to using plugins to improve security and performance, helping you create your own website easily. Choose a blog topic and direction Before purchasing a domain name or registering a host, it is best to identify the topics you plan to cover. Personal websites can revolve around travel, cooking, product reviews, music or any hobby that sparks your interests. Focusing on areas you are truly interested in can encourage continuous writing

What is the WordPress good for? What is the WordPress good for? Apr 07, 2025 am 12:06 AM

WordPressisgoodforvirtuallyanywebprojectduetoitsversatilityasaCMS.Itexcelsin:1)user-friendliness,allowingeasywebsitesetup;2)flexibilityandcustomizationwithnumerousthemesandplugins;3)SEOoptimization;and4)strongcommunitysupport,thoughusersmustmanageper

Can I learn WordPress in 3 days? Can I learn WordPress in 3 days? Apr 09, 2025 am 12:16 AM

Can learn WordPress within three days. 1. Master basic knowledge, such as themes, plug-ins, etc. 2. Understand the core functions, including installation and working principles. 3. Learn basic and advanced usage through examples. 4. Understand debugging techniques and performance optimization suggestions.

How much does WordPress cost? How much does WordPress cost? Apr 05, 2025 am 12:13 AM

WordPress itself is free, but it costs extra to use: 1. WordPress.com offers a package ranging from free to paid, with prices ranging from a few dollars per month to dozens of dollars; 2. WordPress.org requires purchasing a domain name (10-20 US dollars per year) and hosting services (5-50 US dollars per month); 3. Most plug-ins and themes are free, and the paid price ranges from tens to hundreds of dollars; by choosing the right hosting service, using plug-ins and themes reasonably, and regularly maintaining and optimizing, the cost of WordPress can be effectively controlled and optimized.

Should I use Wix or WordPress? Should I use Wix or WordPress? Apr 06, 2025 am 12:11 AM

Wix is ​​suitable for users who have no programming experience, and WordPress is suitable for users who want more control and expansion capabilities. 1) Wix provides drag-and-drop editors and rich templates, making it easy to quickly build a website. 2) As an open source CMS, WordPress has a huge community and plug-in ecosystem, supporting in-depth customization and expansion.

Is WordPress still free? Is WordPress still free? Apr 04, 2025 am 12:06 AM

The core version of WordPress is free, but other fees may be incurred during use. 1. Domain names and hosting services require payment. 2. Advanced themes and plug-ins may be charged. 3. Professional services and advanced features may be charged.

Why would anyone use WordPress? Why would anyone use WordPress? Apr 02, 2025 pm 02:57 PM

People choose to use WordPress because of its power and flexibility. 1) WordPress is an open source CMS with strong ease of use and scalability, suitable for various website needs. 2) It has rich themes and plugins, a huge ecosystem and strong community support. 3) The working principle of WordPress is based on themes, plug-ins and core functions, and uses PHP and MySQL to process data, and supports performance optimization.

See all articles