Wordpress获得多个帖子的更新元

时间:2016-09-07 11:26:39

标签: php wordpress

我正在使用wp更新元值。在我的代码中这里是主要功能:

beforeSelectRow: function (rowid) {
    var $self = $(this),
        savedRowInfos = $self.jqGrid("getGridParam", "savedRow"),
        editingRowId = savedRowInfos == null || savedRowInfos.length < 1 ?
            null : savedRowInfos[0].id;

    if (editingRowId == null || editingRowId === rowid) {
        return true; // allow selection
    }

    $("#dialog-confirm").dialog({
        resizable: false,
        height: "auto",
        width: 650,
        modal: true,
        buttons: {
            "Save the changes": function () {
                $(this).dialog("close");
                $self.jqGrid("saveRow", editingRowId);
                $self.jqGrid("setSelection", rowid);
            },
            "Discard the changes": function () {
                $(this).dialog("close");
                $self.jqGrid("restoreRow", editingRowId);
                $self.jqGrid("setSelection", rowid);
            },
            "Continue editing": function () {
                var tr = $self.jqGrid("getGridRowById", editingRowId);
                $(this).dialog("close");
                setTimeout(function () {
                    $(tr).find("input,textarea,select,button,object,*[tabindex]")
                        .filter(":input:visible:not(:disabled)")
                        .first()
                        .focus();
                }, 50);
            }
        }
    });
    return false; // prevent selection
}

当我选择一个帖子时它正在工作。但是在选择多个帖子时没有工作。

1 个答案:

答案 0 :(得分:0)

这里可能有问题。如果你$get_post_ids[]是一个带有键和带逗号分隔值的数组,那么它必须以$_REQUEST['ids']逗号分隔。然后你必须使用这种方式:

$get_post_ids = $_REQUEST['ids'];
$get_post_ids = explode(',', $get_post_ids);