Title: Tori Ajax
Author: alvinmuthui
Published: <strong>2022-04-12</strong>
Last modified: 2026-03-09

---

Szukaj wtyczek

Wtyczka **nie została przetestowana z trzema ostatnimi głównymi wydaniami WordPressa**.
Może nie być już utrzymywana lub obsługiwana, co może skutkować problemem ze zgodnością
z nowszymi wersjami WordPressa.

![](https://ps.w.org/tori-ajax/assets/icon.svg?rev=2737361)

# Tori Ajax

 Autor: [alvinmuthui](https://profiles.wordpress.org/alvinmuthui/)

[Pobierz](https://downloads.wordpress.org/plugin/tori-ajax.2.0.3.zip)

 * [Szczegóły](https://pl.wordpress.org/plugins/tori-ajax/#description)
 * [Recenzje](https://pl.wordpress.org/plugins/tori-ajax/#reviews)
 *  [Instalacja](https://pl.wordpress.org/plugins/tori-ajax/#installation)
 * [Rozwój](https://pl.wordpress.org/plugins/tori-ajax/#developers)

 [Wsparcie](https://wordpress.org/support/plugin/tori-ajax/)

## Opis

Add AJAX easily by passing an action name, PHP callback, and JavaScript file path
to the toria_add_ajax() function with the Tori Ajax plugin.

### Documentation

Please check out the [Tori Ajax plugin Documentation](https://toriajax.com/documentation)

### About

This is an easy-to-use **dev tool** for adding Ajax in word press.

## Zrzuty ekranu

[⌊Sample theme functions PHP code⌉⌊Sample theme functions PHP code⌉[

Sample theme functions PHP code

[⌊Sample Javascript code⌉⌊Sample Javascript code⌉[

Sample Javascript code

[⌊Sample theme functions PHP code for authenticated and non-authenticated Ajax actions.⌉⌊
Sample theme functions PHP code for authenticated and non-authenticated Ajax actions
.⌉[

Sample theme functions PHP code for authenticated and non-authenticated Ajax actions.

[⌊Sample theme functions PHP code for authenticated Ajax actions.⌉⌊Sample theme 
functions PHP code for authenticated Ajax actions.⌉[

Sample theme functions PHP code for authenticated Ajax actions.

[⌊Sample theme functions PHP code for non-authenticated Ajax actions.⌉⌊Sample theme
functions PHP code for non-authenticated Ajax actions.⌉[

Sample theme functions PHP code for non-authenticated Ajax actions.

## Instalacja

 1. Upload `tori-ajax` folder to the `/wp-content/plugins/` directory
 2. Activate the plugin through the 'Plugins’ menu in WordPress
 3. Add custom code to add ajax in your theme functions or anywhere else desirable.
    For example:

    ```
     function my_simple_ajax() {
        // Magic happens here.
        echo json_encode( 'Welcome to Tori Ajax' );
    }

    if ( function_exists( 'toria_add_ajax' ) ) {
        toria_add_ajax(
            'simple',
            'my_simple_ajax',
            get_stylesheet_directory_uri() . '/inc/my_custom_ajax/toria_ajax.js'
        );
    }
    ```

 1. Create a javascript file in the `inc/my_custom_ajax/toria_ajax.js`.
 2. Add Javascript code. For example:

    ```
    function tori_ajax() {
        jQuery.ajax({
            type: "post",
            url: toria.ajax_url, // admin-ajax.php path,
            data: {
                action: toria.action, // action
                nonce: toria.nonce,   // pass the nonce here
            },
            success: function (data) {
                console.log(data.trim());
                //alert(data.trim());
            },
            error: function (errorThrown) {
                console.log(errorThrown);
            }
        });
    }
    tori_ajax();// call the function.
    ```

## Najczęściej zadawane pytania

### How to solve toria_add_ajax() is undefined?

 * By ensuring the Tori Ajax plugin is installed.
 * Use the if statement to check if the toria_add_ajax() exists first before using
   it. For example:
    ~~~~ if ( function_exists( 'toria_add_ajax’ ) ) { toria_add_ajax('
   simple’, 'my_simple_ajax’, get_stylesheet_directory_uri() . '/inc/my_custom_ajax/
   toria_ajax.js’ ); } ~~~~

### How to register action for both logged in and non logged in users?

You can use the fourth parameter to set the mode to _’both’_.
 By default, the mode
is set to _’private’_ for authenticated Ajax actions for logged-in users. You can
also use _’public’_ to expose the Ajax action to non-authenticated Ajax actions 
for logged-out users **Summary** _both_ – For exposing the Ajax action to authenticated
Ajax actions for logged-in users and non-authenticated Ajax actions for logged-out
users. Example

    ```
    if ( function_exists( 'toria_add_ajax' ) ) {
        toria_add_ajax(
            'simple',
            'my_simple_ajax',
            get_stylesheet_directory_uri() . '/inc/my_custom_ajax/toria_ajax.js',
            'both'
        );
    }
    ```

_private_ – For exposing the Ajax action to authenticated Ajax actions for logged-
in users.
 Example

    ```
    if ( function_exists( 'toria_add_ajax' ) ) {
        toria_add_ajax(
            'simple',
            'my_simple_ajax',
            get_stylesheet_directory_uri() . '/inc/my_custom_ajax/toria_ajax.js',
            'private'
        );
    }
    ```

Or

    ```
    if ( function_exists( 'toria_add_ajax' ) ) {
        toria_add_ajax(
            'simple',
            'my_simple_ajax',
            get_stylesheet_directory_uri() . '/inc/my_custom_ajax/toria_ajax.js'
        );
    }
    ```

_public_ – For exposing the Ajax action to non-authenticated Ajax actions for logged-
out users.
 Example

    ```
    if ( function_exists( 'toria_add_ajax' ) ) {
        toria_add_ajax(
            'simple',
            'my_simple_ajax',
            get_stylesheet_directory_uri() . '/inc/my_custom_ajax/toria_ajax.js',
            'public'
        );
    }
    ```

## Recenzje

Wtyczka nie ma jeszcze żadnej recenzji.

## Kontrybutorzy i deweloperzy

„Tori Ajax” jest oprogramowaniem open source. Poniższe osoby miały wkład w rozwój
wtyczki.

Zaangażowani

 *   [ alvinmuthui ](https://profiles.wordpress.org/alvinmuthui/)

[Przetłumacz wtyczkę “Tori Ajax” na swój język.](https://translate.wordpress.org/projects/wp-plugins/tori-ajax)

### Interesuje cię rozwój wtyczki?

[Przeglądaj kod](https://plugins.trac.wordpress.org/browser/tori-ajax/), sprawdź
[repozytorium SVN](https://plugins.svn.wordpress.org/tori-ajax/) lub czytaj [dziennik rozwoju](https://plugins.trac.wordpress.org/log/tori-ajax/)
przez [RSS](https://plugins.trac.wordpress.org/log/tori-ajax/?limit=100&mode=stop_on_copy&format=rss).

## Rejestr zmian

#### 1.0.0

 * The beginning of the Tori Ajax plugin.

#### 1.0.1

 * Fixed: Uncaught ArgumentCountError during the nonce check.
 * Added JSON output for nonce messages.

#### 1.0.2

 * Added 3 optional arguments to _toria\_add\_ajax()_ function:
    1. `$script_depends` (string[]) (Optional) An array of registered script handles
       this script depends on. Default value: array().
    2. `$script_version` (string|bool|null) (Optional) String specifying script version
       number, if it has one, which is added to the URL as a query string for cache
       busting purposes. If the version is set to false, a version number is automatically
       added equal to the current installed Tori Ajax version. If set to null, no version
       is added. Default value: false.
    3. `$script_in_footer` (bool) (Optional) Whether to enqueue the script before instead
       of in the . Default 'false’.
 * Added support for PHP version 5.6.20 and above
 * Added compatibility of WordPress Version 3.0 and above

#### 1.0.3

 * Fixed: PHP Notice undefined variable: allowed_html

#### 1.1.0

 * Compatible with WordPress 6.0.
 * Added filters:
    apply_filters( 'toria/ajax/action’, $action ); apply_filters('
   toria/ajax/php_callback’, $php_callback, $action ); apply_filters( 'toria/ajax/
   script_path’, $script_path, $action, $php_callback ); apply_filters( 'toria/ajax/
   mode’, $mode, $action, $php_callback, $script_path ); apply_filters( 'toria/ajax/
   nonce’, $nonce, $action, $php_callback, $script_path, $mode ); apply_filters('
   toria/ajax/ajax_object’, $ajax_object, $action, $php_callback, $script_path, 
   $mode ); apply_filters( 'toria/ajax/ajax_handle’, $ajax_handle, $action, $php_callback,
   $script_path, $mode ); apply_filters( 'toria/ajax/script_depends’, $script_depends,
   $action, $php_callback, $script_path, $mode ); apply_filters( 'toria/ajax/script_version’,
   $script_version, $action, $php_callback, $script_path, $mode ); apply_filters('
   toria/ajax/script_in_footer’, $script_in_footer, $action, $php_callback, $script_path,
   $mode ); apply_filters( 'toria/ajax/ajax_variables’, $ajax_variables, $action,
   $php_callback, $script_path, $mode );

#### 1.2.0

*Added more parameters to some filters.
 *The affected filters are: apply_filters('
toria/ajax/ajax_object’, $ajax_object, $action, $php_callback, $script_path, $mode,
$nonce ); apply_filters( 'toria/ajax/ajax_handle’, $ajax_handle, $action, $php_callback,
$script_path, $mode, $nonce, $ajax_object ); apply_filters( 'toria/ajax/script_depends’,
$script_depends, $action, $php_callback, $script_path, $mode, $nonce, $ajax_object,
$ajax_handle ); apply_filters( 'toria/ajax/script_version’, $script_version, $action,
$php_callback, $script_path, $mode, $nonce, $ajax_object, $ajax_handle, $script_depends);
apply_filters( 'toria/ajax/script_in_footer’, $script_in_footer, $action, $php_callback,
$script_path, $mode, $nonce, $ajax_object, $ajax_handle, $script_depends, $script_version);
apply_filters( 'toria/ajax/ajax_variables’, $ajax_variables, $action, $php_callback,
$script_path, $mode, $nonce, $ajax_object, $ajax_handle, $script_depends, $script_version,
$script_in_footer );

#### 2.0.0

 * Compatible with WordPress 6.1.1.
 * Fix: Ajax in **private** mode is only accessible by signed-in users and those
   in **public** are only accessible by signed-out users.
 * Pro version available.

#### 2.0.1

 * Fixed a PHP Deprecated notice.

#### 2.0.2

 * Added plugin meta links in wp-admin/plugins.php

## Meta

 *  Wersja **2.0.3**
 *  Ostatnia aktualizacja **8 miesięcy temu**
 *  Włączone instalacje **Mniej niż 10**
 *  Wersja WordPressa ** 3.0.0 lub nowszej **
 *  Testowano do **6.8.12**
 *  Wersja PHP ** 5.6.20 lub nowszej **
 *  Język
 * [English (US)](https://wordpress.org/plugins/tori-ajax/)
 * Tagi
 * [ajax](https://pl.wordpress.org/plugins/tags/ajax/)[javascript](https://pl.wordpress.org/plugins/tags/javascript/)
 *  [Widok zaawansowany](https://pl.wordpress.org/plugins/tori-ajax/advanced/)

## Oceny

Nie przesłano jeszcze żadnych recenzji.

[Twoja opinia](https://wordpress.org/support/plugin/tori-ajax/reviews/#new-post)

[Zobacz wszystkierecenzje.](https://wordpress.org/support/plugin/tori-ajax/reviews/)

## Zaangażowani

 *   [ alvinmuthui ](https://profiles.wordpress.org/alvinmuthui/)

## Wsparcie

Masz coś do dodania? Potrzebujesz pomocy?

 [Zobacz forum wsparcia](https://wordpress.org/support/plugin/tori-ajax/)

## Złóż datek

Czy chcesz wesprzeć rozwój wtyczki?

 [ Wspomóż wtyczkę ](https://www.buymeacoffee.com/alvinmuthui)