Coder Social home page Coder Social logo

wp-no-admin-ajax's Introduction

geniem-github-banner

WP Plugin: No-Admin-Ajax

Latest Stable Version Total Downloads Latest Unstable Version License

A WordPress plugin that changes the WP AJAX routine and rewrites the ajax requests to custom url rather than /wp-admin/admin-ajax.php back-end.

Install

Recommended installation to WP project is through composer:

$ composer require devgeniem/wp-no-admin-ajax

Use cases

  • Rewrite all admin-ajax.php queries into custom url so you can allow /wp-admin/ to only certain IP-addresses.
  • You can use this to confuse bots which might try to use vulnerabilities in admin-ajax.php.

Configuration

Variables

This plugin url is by default /no-admin-ajax/. You can use filters to change it or you can set the default value by yourself by using:

// This turns the no admin ajax url to -> /ajax/
define('WP_NO_ADMIN_AJAX_URL','ajax');

Notice: Value set here can be filtered too, this just sets the starting point for the custom url.

Notice 2: After plugin installation and other changes be sure to refresh your permalinks by just going to Settings > Permalinks > and saving it without any modification.

Hooks & Filters

You can customize the url by using filter no-admin-ajax/keyword.

<?php

// This changes /no-admin-ajax/ -> /ajax/
add_filter( 'no-admin-ajax/keyword', 'my_custom_no_admin_ajax_url' );
function my_custom_no_admin_ajax_url( $ajax_url ) {
    return "ajax";
}

You can run commands before ajax calls by using no-admin-ajax/before or no-admin-ajax/before/{action}

<?php
// Writes log entries after hearthbeat action for debugging
do_action( 'no-admin-ajax/before/heartbeat' , 'my_custom_no_admin_ajax_debug' );
function my_custom_no_admin_ajax_debug() {
    error_log( 'DEBUG | heartbeat action was run by: '.$_SERVER[“REMOTE_ADDR”] );
}

wp-no-admin-ajax's People

Contributors

onnimonni avatar lucafilosofi avatar nomafin avatar

Stargazers

pekarskyi avatar Saulo Paiva avatar Ahmad Karim avatar  avatar Whit avatar Protein One avatar Olivier Gorzalka avatar Kenan SALTIK avatar Serkan Algur avatar Patrick Groot avatar Huub avatar  avatar  avatar Jordan Charters avatar Brandon avatar Tang Rufus avatar  avatar John Nwanosike avatar  avatar Uğur Erkan avatar Calvin Chia avatar Thanh avatar flowdee avatar Sérgio Santos avatar  avatar Reilly Lowery avatar Mehrshad Darzi avatar  avatar  avatar Timi-Artturi Mäkelä avatar Eeppo avatar Christian Nikkanen avatar Viljami Kuosmanen avatar Kalle Laakso avatar Timi Wahalahti avatar

Watchers

Hannu Kumpula avatar James Cloos avatar Jussi Löf avatar  avatar  avatar Juho Lehtinen avatar villesiltala avatar Patrick Groot avatar Kenan SALTIK avatar  avatar  avatar  avatar

wp-no-admin-ajax's Issues

Installing wp-no-admin-ajax with composer (Issue/docs)

Currently i'm unable to make it to work within a project.

It doesn't seem to work.

Running composer require devgeniem/wp-no-admin-ajax installs just a empty folder 'vendor/devgeniem'. When downloading the plugin manually and dropping it in the 'vendor/devgeniem' folder still it doesn't seem to work in any way when it's included into a project.

Other information i'm including the package into a theme instead of a plugin not sure if this matters?

The plugin itself installed as a normal wp plugin is working fine.

Could you shed some light on what i'm missing when i want to include it in my project using composer?

Kr,
Patrick

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.