Skip to content

Instantly share code, notes, and snippets.

@dhananjaygbhardwaj
dhananjaygbhardwaj / custom-recent-posts-widget.php
Last active December 10, 2022 07:31
A custom widget for displaying a list of recently published posts on WP.
<?php
/**
* Plugin Name: Custom Recent Posts
* Description: Custom Recent Posts with thumbnail sidebar widget
* Version: 1.0
* Author: Dhananjay Bhardwaj
*/
/**
* Core class used to implement a Recent Posts widget.
@dhananjaygbhardwaj
dhananjaygbhardwaj / Cleaning-Hacked-WP.txt
Last active November 17, 2022 07:28 — forked from DrewDouglass/steps.txt
Cleaning a hacked WordPress website.
Cleaning a (typical) Hacked Site
- Create backup of site
- Deactivate any unnecessary plugins. Delete any plugins and themes that are not in use.
- Update all plugins and WordPress through WP admin. We'll replace everything later, but this allows any database updates to happen.
- Download wordpress.org/latest.zip.
- Download fresh copies of every plugin.
- If ACF 4.x installed, upload ACF 5.x and go through database updates (if multi-site, have to go through each site as of now). Then delete ACF 4.x and add-on plugins.
- Review wp-config.php to make sure there is no malicious code. If not confident, install fresh copy of wp-config.php with correct database information.
- Deactivate site by commenting out database info in wp-config.php
- Delete all files and folders in root directory except wp-config.php and wp-content/, and possibly any non-WP folders such as emails.
@dhananjaygbhardwaj
dhananjaygbhardwaj / comment-notes-before.php
Created March 4, 2022 18:28 — forked from cdils/comment-notes-before.php
Customize the text before the comment form in WordPress. Note: Logged in users will not see this text.
<?php //remove this line
add_filter( 'comment_form_defaults', 'cd_pre_comment_text' );
/**
* Change the text output that appears before the comment form
* Note: Logged in user will not see this text.
*
* @author Carrie Dils <http://www.carriedils.com>
* @uses comment_notes_before <http://codex.wordpress.org/Function_Reference/comment_form>
*