Skip to content

Instantly share code, notes, and snippets.

View mustafauysal's full-sized avatar
💭
addressing some issues... 🧑🏻‍💻

Mustafa Uysal mustafauysal

💭
addressing some issues... 🧑🏻‍💻
View GitHub Profile
<?php
/**
* Magic Login Pro - Email Confirmation Enforcement
*
* This snippet requires users to confirm their email address when registering
* via Magic Login Pro. Users must click the magic login link in their email
* to confirm their email address before they can log in.
*
* How it works:
* 1. When a user registers, they are marked as "email unconfirmed"
@mustafauysal
mustafauysal / move-powered-cache-under-settings.php
Created November 20, 2025 20:20
Moves "Powered Cache" menu under general settings
<?php
add_action( 'admin_menu', 'move_powered_cache_under_settings', 999 );
function move_powered_cache_under_settings() {
if ( ! is_admin() ) {
return;
}
global $menu, $submenu;
<?php
/**
* Add JavaScript to modify login field for email-only input
*/
function fix_magic_login_set_email_only() {
?>
<script type="text/javascript">
(function() {
@mustafauysal
mustafauysal / CHATGPT VERSION (GPT-4 | GPT-4.1)
Created June 19, 2025 15:04 — forked from iamnolanhu/CHATGPT VERSION (GPT-4 | GPT-4.1)
REALITY FILTER — A LIGHTWEIGHT TOOL TO REDUCE LLM FICTION WITHOUT PROMISING PERFECTION
✅ REALITY FILTER — CHATGPT
• Never present generated, inferred, speculated, or deduced content as fact.
• If you cannot verify something directly, say:
- “I cannot verify this.”
- “I do not have access to that information.”
- “My knowledge base does not contain that.”
• Label unverified content at the start of a sentence:
- [Inference] [Speculation] [Unverified]
• Ask for clarification if information is missing. Do not guess or fill gaps.
@mustafauysal
mustafauysal / clean-woo-product-term-archives.php
Last active February 15, 2024 21:28
Quick fix to purge product archives when product updated.
<?php
add_filter( 'powered_cache_advanced_cache_purge_urls', function ( $urls, $post_id ) {
if ( 'product' === get_post_type( $post_id ) ) {
$urls[] = get_permalink( $post_id );
$urls[] = get_permalink( wc_get_page_id( 'shop' ) );
$terms = wp_get_post_terms( $post_id, [ 'product_tag', 'product_cat' ] );
foreach ( $terms as $term ) {
$urls[] = get_term_link( $term );
@mustafauysal
mustafauysal / change-magic-login-shortcode-msg.php
Created January 5, 2024 16:49
example snippet to change magic login default message dynamically with JS
<?php
add_action( 'wp_footer', function () {
?>
<script>
document.addEventListener('DOMContentLoaded', function () {
var messageElement = document.querySelector('.magic-login-form-header .message');
if (messageElement) {
messageElement.innerText = 'Your new message here';
}
<?php
add_action( 'plugins_loaded', function () {
$request_url = isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : '';
if ( false !== strpos( $request_url, '/checkout' ) || false !== strpos( $request_url, '/finalizar-compra' ) ) {
add_filter( 'powered_cache_fo_disable', '__return_true' );
add_filter( 'powered_cache_fo_disable_css_combine', '__return_true' );
add_filter( 'powered_cache_fo_disable_css_minify', '__return_true' );
add_filter( 'powered_cache_fo_disable_js_combine', '__return_true' );
<?php
add_action( 'wp_footer', 'magic_login_auto_fill_email_from_url' );
add_action( 'login_footer', 'magic_login_auto_fill_email_from_url' );
function magic_login_auto_fill_email_from_url() {
?>
<script>
// Function to get URL parameters
function getURLParameter(name) {
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
# Pass .well-known/security.txt to WordPress
RewriteRule ^\.well-known/security\.txt$ index.php [L]
@mustafauysal
mustafauysal / phast-purge-with-powered-cache.php
Last active May 23, 2023 14:39
Remove phastpress cache when purging cache on Powered Cache
<?php
add_action( 'plugins_loaded', function () {
add_action( 'powered_cache_flushed', 'flush_phast_cache' );
add_action( 'powered_cache_purge_all_cache', 'flush_phast_cache' );
add_action( 'powered_cache_clean_site_cache_dir', 'flush_phast_cache' );
} );
function flush_phast_cache() {
$cache_dir = WP_CONTENT_DIR . '/cache/';