Skip to content

Instantly share code, notes, and snippets.

View maheshwaghmare's full-sized avatar
🎯
Focusing

Mahesh Waghmare maheshwaghmare

🎯
Focusing
View GitHub Profile
@maheshwaghmare
maheshwaghmare / .htaccess
Created July 14, 2020 14:59 — forked from Zodiac1978/.htaccess
Make your Website faster - a safe htaccess way
#
# Sources:
# http://stackoverflow.com/questions/7704624/how-can-i-use-gzip-compression-for-css-and-js-files-on-my-websites
# http://codex.wordpress.org/Output_Compression
# http://www.perun.net/2009/06/06/wordpress-websites-beschleuinigen-4-ein-zwischenergebnis/#comment-61086
# http://www.smashingmagazine.com/smashing-book-1/performance-optimization-for-websites-part-2-of-2/
# http://gtmetrix.com/configure-entity-tags-etags.html
# http://de.slideshare.net/walterebert/die-htaccessrichtignutzenwchh2014
# http://de.slideshare.net/walterebert/mehr-performance-fr-wordpress
# https://andreashecht-blog.de/4183/
@maheshwaghmare
maheshwaghmare / add-current-post-updated-year.php
Created July 6, 2020 13:39
WordPress SEO - Register current post updated year as a custom tag or variable in to the Yoast SEO plugin. We can use the %%post_updated_year%% into the title. Read more at https://maheshwaghmare.com/doc/yoast-seo-custom-template-variable/
<?php
if( ! function_exists( 'prefix_yoast_register_post_updated_year' ) ) :
/**
* Register Current Post Publish Year
*
* @todo Change the `prefix_` with your own custom prefix.
* @since 1.0.0
* @return void
*/
function prefix_yoast_register_post_updated_year() {
@maheshwaghmare
maheshwaghmare / get-post-by-meta-key-and-meta-value.php
Last active November 14, 2025 12:30
Get all post by post meta key and meta value using meta_query in WP_Query(). Read more at https://wp.me/p4Ams0-14E
<?php
/**
* Get all post by post meta key and meta value.
*
* @todo Change the `prefix_` and with your own unique prefix.
*
* @since 1.0.0
*/
if( ! function_exists( 'prefix_search_post_by_post_meta_value' ) ) :
function prefix_search_post_by_post_meta_value() {
@maheshwaghmare
maheshwaghmare / remove-author-link-from-author-box.php
Created September 3, 2018 07:33
Astra Theme - Remove author link from the author box.
@maheshwaghmare
maheshwaghmare / excel-csv-find-duplicate.md
Last active March 25, 2025 16:15
Find duplicate cells in excel sheet/csv file.

Use below function COUNTIF() to check the duplicate cell from excel sheet.

How to use?

Use =COUNTIF ({ROW}:{ROW},{Start from}) > 1

E.g. Below we check the duplicate values from row B start from B1. Use formula =COUNTIF (B:B,B2) > 1

---------------------------------------------------------
|	A | B	| C |
@maheshwaghmare
maheshwaghmare / readme.md
Last active March 24, 2025 15:19
Line no count from each text file for the current directory on windows.

**Case: ** Count no of lines from each *.txt file from the files directory.

In files directory struture is below:

/files/
     - /test/
          -- log.txt
     - /test2/
 -- log.txt
@maheshwaghmare
maheshwaghmare / curl-website-speed-test-with-no-cache.sh
Last active February 25, 2025 09:17
Test the website speed with CURL request though command line.
curl -s -o /dev/null -w "%{time_total}\n" -H "Pragma: no-cache" https://maheshwaghmare.com/
<?php
/**
* Add meta fields support in rest API for post type `Post`
*
* This function will allow custom parameters within API request URL. Add post meta support for post type `Post`.
*
* > How to use?
* http://mysite.com/wp-json/wp/v2/posts?meta_key=<my_meta_key>&meta_value=<my_meta_value>
*
* > E.g. Get posts which post meta `already-visited` value is `true`.
@maheshwaghmare
maheshwaghmare / debug-http-request.php
Last active December 26, 2024 19:53
Debug the HTTP requests in WordPress wp_remote_post() or wp_remote_get() with the help of `http_api_debug` hook.
<?php
/**
* Debug HTTP requests in WordPress
*
* Fires after an HTTP API response is received and before the response is returned.
*
* Output in `wp-content\debug.log` file:
*
* [24-Apr-2019 06:50:16 UTC] ------------------------------
* [24-Apr-2019 06:50:16 UTC] https://downloads.wordpress.org/plugin/elementor.2.5.14.zip
@maheshwaghmare
maheshwaghmare / README.md
Created November 14, 2024 13:40
Gutenberg | Find blocks by block name - Recursively search for blocks by name within a nested block structure.
// Example usage.
import { parse } from '@wordpress/blocks'

const parsedContent = parse( content, {
	__unstableSkipMigrationLogs: true,
} )

const blocks = findNestedBlocksByName( parsedContent, 'core/paragraph' );