WordPress的创建类别AJAX响应 [英] Wordpress Create Category AJAX Response

查看:71
本文介绍了WordPress的创建类别AJAX响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个插件,允许用户激活/停用类别以驱动菜单。我已经为切换创建了一个选项,并使其可以在创建表单和无缝编辑表单中正常运行。创建类别后,我似乎唯一无法添加的地方就是wordpress的AJAX返回。我可以在加载类别页面时创建该列,但是不知道如何在不修改核心的情况下使用AJAX Return。我不知道有没有一个钩子可以让您修改此回报?

I currently have a plugin that allows a user to activate/deactivate categories to drive a menu. I've created an option for the toggle and have it functioning in the create form and edit form seamlessly. The only place I can't seem to add it is to the AJAX return from wordpress when the category is created. I can create the column when the Categories page is loaded but don't know how to tap into the AJAX Return without modifying the core. Is there a hook that I'm unaware of that allows you to modify this return?

推荐答案

使用Akmal的答案,这是我的脚本来检查是否创建了分类法类别。
感谢Akmal。

Using Akmal's answer, this is my script to check if the Taxonomy-Category was created or not. Thanks Akmal.

WordPress版本3.8.2

Wordpress version 3.8.2

        $(document).ajaxComplete(function(event, xhr, settings) {
            var queryStringArr = settings.data.split('&');
                if( $.inArray('action=add-tag', queryStringArr) !== -1){
                    var xml = xhr.responseXML;
                    $response = $(xml).find('term_id').text();
                    if($response!=""){
                        console.log('This is the action.');

                    }
                }
        });

这篇关于WordPress的创建类别AJAX响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆