{"id":1049,"date":"2024-04-16T20:01:39","date_gmt":"2024-04-16T11:01:39","guid":{"rendered":"http:\/\/inwelly.com\/?p=1049"},"modified":"2024-04-23T05:34:26","modified_gmt":"2024-04-22T20:34:26","slug":"wordpress-delete_post_meta-by-meta_value","status":"publish","type":"post","link":"https:\/\/inwelly.com\/?p=1049","title":{"rendered":"wordpress delete_post_meta by meta_value"},"content":{"rendered":"\n<p>\/\/ Delete item.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>if( isset($_POST[&#8216;delete_item&#8217;]) &amp;&amp; $_POST[&#8216;delete_item&#8217;] !=&#8221; )<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>$jsDelItems = json_decode(stripslashes($_POST[&#8216;delete_item&#8217;]));<\/p>\n\n\n\n<p>$delData = array();<\/p>\n\n\n\n<p>foreach( $jsDelItems as $menuArr )<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>$delData = Array(<\/p>\n\n\n\n<p>&#8216;idx&#8217; =&gt; $menuArr-&gt;idx ,<\/p>\n\n\n\n<p>&#8216;label&#8217; =&gt; $menuArr-&gt;label ,<\/p>\n\n\n\n<p>&#8216;link&#8217; =&gt; $menuArr-&gt;link ,<\/p>\n\n\n\n<p>&#8216;order&#8217; =&gt; $menuArr-&gt;order,<\/p>\n\n\n\n<p>&#8216;status&#8217; =&gt; $menuArr-&gt;status,<\/p>\n\n\n\n<p>&#8216;type&#8217; =&gt; $menuArr-&gt;type ,<\/p>\n\n\n\n<p>);<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>functionarraySearchMultiKeyVal($dataList = [], $arrKeyValFind = [], $is_return_key = false) {<\/p>\n\n\n\n<p>$index = array_keys($dataList, $arrKeyValFind);<\/p>\n\n\n\n<p>if ($index) {<\/p>\n\n\n\n<p>$key = $index[0];<\/p>\n\n\n\n<p>if ($is_return_key) {<\/p>\n\n\n\n<p>return$key;<\/p>\n\n\n\n<p>} else {<\/p>\n\n\n\n<p>return$dataList[$key];<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>returnfalse;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>$get_all_meta_value = get_post_meta($nvWmaMenuPostId, &#8216;_nv_wma_menu&#8217; );<\/p>\n\n\n\n<p>$result_key = arraySearchMultiKeyVal($get_all_meta_value, $delData);<\/p>\n\n\n\n<p>delete_post_meta( $nvWmaMenuPostId , &#8216;_nv_wma_menu&#8217; , $result_key );<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\/\/ Delete item. if( isset($_POST[&#8216;delete_item&#8217;]) &amp;&amp; $_POST[&#8216;delete_item&#8217;] !=&#8221; ) { $jsDelItems = json_decode(stripslashes($_POST[&#8216;delete_item&#8217;])); $delData = array(); foreach( $jsDelItems as $menuArr [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1250,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[109],"tags":[],"class_list":["post-1049","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress"],"_links":{"self":[{"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/posts\/1049","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/inwelly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1049"}],"version-history":[{"count":1,"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/posts\/1049\/revisions"}],"predecessor-version":[{"id":1050,"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/posts\/1049\/revisions\/1050"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/media\/1250"}],"wp:attachment":[{"href":"https:\/\/inwelly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1049"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/inwelly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1049"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/inwelly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1049"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}