Support

Account

Home Forums General Issues XMLRPC Relationship field Reply To: XMLRPC Relationship field

  • for example on the end of wp-settings.php I add:

    class XmlRpcAcf {
        public function __construct(){
            add_action('save_post', array( $this,'my_save_post'), 12, 3);
        }
        public function my_save_post( $post_ID, $post, $update ){
            //error_log("XmlRpcAcf.save_post($update)[$post_ID]:".json_encode($post), 0);
            if (!array_key_exists('_acf_nonce', $_POST)) {
                foreach ( (array) has_meta( $post_ID ) as $meta ) {
                    if (substr($meta["meta_key"], 0, 1) == '_') {
                        continue;
                    }
                    update_field( $meta["meta_key"], $meta["meta_value"], $post_ID );
                    //error_log("XmlRpcAcf.save_post.meta:".json_encode($meta), 0);
                }
            }
        }
    }
    $myMXmlRpcAcf = new XmlRpcAcf();