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 / debug-http-request.php
Last active March 26, 2024 21:15
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 / curl-website-speed-test-with-no-cache.sh
Last active March 14, 2024 07:08
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/
@maheshwaghmare
maheshwaghmare / social-share-url-patterns.txt
Created May 13, 2017 09:54
Social Share URL Patterns. E.g. Facebook, Twitter, Google+, Pintrest, LinkedIn, Buffer, Digg etc.
Sharer : https://www.facebook.com/sharer.php?u={url}
Twitter : https://twitter.com/intent/tweet?url={url}&text={title}&via={via}&hashtags={hashtags}
Google : https://plus.google.com/share?url={url}
Pinterest : https://pinterest.com/pin/create/bookmarklet/?media={img}&url={url}&is_video={is_video}&description={title}
LinkedIn : https://www.linkedin.com/shareArticle?url={url}&title={title}
Buffer : https://buffer.com/add?text={title}&url={url}
Digg : http://digg.com/submit?url={url}&title={title}
Tumblr : https://www.tumblr.com/widgets/share/tool?canonicalUrl={url}&title={title}&caption={desc}
Reddit : https://reddit.com/submit?url={url}&title={title}
StumbleUpon : http://www.stumbleupon.com/submit?url={url}&title={title}
<?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 / .bashrc
Created September 7, 2018 06:07
Keyboard shortcut/aliases for the WP CLI, Git, Grunt & PHPCS commands for windows
# ----------------------
# WP CLI
# ----------------------
alias wpthl='wp theme list'
alias wppll='wp plugin list'
# ----------------------
# Git Command Aliases
# ----------------------
alias ga='git add'
@maheshwaghmare
maheshwaghmare / custom-hooks.php
Created December 5, 2018 06:19
Astra Pro - Add custom hook into WooCommerce My Account hooks group.
<?php
/**
* Add Hooks into Custom Hooks.
*
* Common Hook: woocommerce_account_content - [Use priority 0-9 to show in Top and 10-xxx to show in Bottom]
*
* Tab Specific Hooks:
* - Orders Tab: woocommerce_account_orders_endpoint - [Only at top]
* - Downloads Tab: woocommerce_account_downloads_endpoint - [Only at top]
@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 / change-page-layout-for-custom-post-type.php
Created June 5, 2018 11:49
Theme: Astra - Change Page Layout for custom post type.
<?php
/**
* Theme: Astra
*
* Change Page Layout for custom post type.
*
* E.g. Set page layout for the post type `members_only`
*
* @since 1.0.0
*/
@maheshwaghmare
maheshwaghmare / hello-world.html
Last active May 3, 2023 19:54
The page generated with Auto-GPT-0.2.2. Read how to install, and use the AutoGPT in article https://maheshwaghmare.com/ai/autogpt/
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
<style>
.card {
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
width: 50%;
@maheshwaghmare
maheshwaghmare / index.php
Created April 25, 2023 07:37
Exclude post type from rank math analytics. Here we excluded the `plgnoptmzr_work` post type from the Rank Math analytics screens. Note: After adding the code just update any single excluded post type once so the Rank Math re-analyze and exclude the post type from the database.
<?php
if ( ! function_exists( 'prefix_rank_math_excluded_post_types' ) ) :
function prefix_rank_math_excluded_post_types( $post_types = [] ) {
// Add the post types which you want to exclude.
$excludes = [
'plgnoptmzr_work',
];
return array_diff_key( $post_types, array_flip( $excludes ) );