DEV Community

Farooq khan
Farooq khan

Posted on • Edited on

1 2

How to download , apply, revert patches in wordpress

To download a patch , go to plugin trac history and download it,.
it is also called as development blog or changelog.
Today I’m going to patch aregato autoresponder plugin by using its changelogs.

The new version of aregato diff file santizes the input ,.
The previous version had the bug which will be easily hacked by cross side scripting.

Get the diff file from below link .

https://plugins.trac.wordpress.org/changeset?old_path=%2Fbft-autoresponder&old=1943235&new_path=%2Fbft-autoresponder&new=1943235&sfp_email=&sfph_mail=

Change log is 1943235 .

Scroll to bottom., click on Unified Diff and download the diff file.

Now move the changeset diff file to your wordpress site where bft autoresponder plugin located.

Now I’m going to patch only one file /views/unsubscribe.html.php file.
Move the diff file to

wp-content/plugins/bft-autoresponder/views/

Now put the following command and replace the filename.diff with your diff file name.

=== $ patch -p0 > filename.diff ===
Enter fullscreen mode Exit fullscreen mode

It will run the command and give following lines.

== The text leading up to this was: ==
== ————————– ==
== |Index: /bft-autoresponder/trunk/views/unsubscribe.html.php ==
== |=================================================================== ==
== |— /bft-autoresponder/trunk/views/unsubscribe.html.php (revision 1943234) ==
== |+++ /bft-autoresponder/trunk/views/unsubscribe.html.php (revision 1943235) ==
== ————————– ==
== File to patch: unsubscribe.html.php ==
== patching file unsubscribe.html.php ==
Enter fullscreen mode Exit fullscreen mode

Now check the unsubscribe.html.php file . Line no 3 should be changed .

To revert the patch put the following command.

$patch -p0 -R filename.diff
Enter fullscreen mode Exit fullscreen mode

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay