Skip to content

Instantly share code, notes, and snippets.

View mehdi-eybak's full-sized avatar
🏠
کار از خانه

mehdi eybak abadi mehdi-eybak

🏠
کار از خانه
View GitHub Profile
@mehdi-eybak
mehdi-eybak / Remove plugin information from the plugins page wordpress.php
Last active November 15, 2022 22:05
Use the filter below to delete the information of the plugin installed in WordPress and the WordPress plugins page. Note that in the first value, put the folder and the main file of the plugin, and in the second value, only the main file of the plugin without adding the folder.
<?php
add_filter( 'all_plugins', function ( $plugins ) {
$shouldHide = ! array_key_exists( 'show_all', $_GET );
if ( $shouldHide ) {
$hiddenPlugins = [
'woocommerce-checkout-manager/woocommerce-checkout-manager.php',
'woocommerce-checkout-manager.php',
];
foreach ( $hiddenPlugins as $hiddenPlugin ) {
<?php
if(isset($_POST['login'])) {
if(!isset($_POST['g-recaptcha-response']) || empty($_POST['g-recaptcha-response'])) {
echo 'reCAPTHCA verification failed, please try again.';
} else {
$secret = 'google_secret_key';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@deepak-rajpal
deepak-rajpal / simplexml-curl-feed-fetch.php
Created September 3, 2015 13:48
Fetch XML Feeds using cURL and SimpleXML - Best and Tested
<?php
/* Fetch XML feeds using PHP SimpleXML and cURL */
/* Step 1) Parse xml url in curl and assign all data into a variable
Step 2) Pass Xml data into SimpleXML and access elements using returned object */
/* =================The SimpleXML =========================
The SimpleXML extension provides a very simple and easily usable toolset to convert XML to an object that can be processed with normal property selectors and array iterators.
This extension requires the libxml PHP extension. This means that passing in --enable-libxml is also required, although this is implicitly accomplished because libxml is enabled by default. The SimpleXML extension requires PHP 5.
@carlosleopoldo
carlosleopoldo / delete-orphans-usermeta.sql
Last active June 16, 2023 13:23
Delete all orphans user meta in WordPress
DELETE FROM wp_usermeta
WHERE NOT EXISTS (
SELECT * FROM wp_users
WHERE wp_usermeta.user_id = wp_users.ID
)