Wednesday, October 12, 2022
HomeWordPress DevelopmentCustomized fields: Break up knowledge from single customized discipline's sub-array to separate...

Customized fields: Break up knowledge from single customized discipline’s sub-array to separate customized fields when saving submit


TLDR; I’m utilizing a plugin that shops its knowledge in a sub-array, and I wish to save knowledge from the sub-array to separate customized fields when a submit will get saved.

In my case, it’s a plugin that exhibits a map on the edit display screen of a submit the place you may add a number of markers by wanting up an handle, and it shops – amongst different knowledge – the longitude and latitude knowledge of the marker(s) right into a sub-array. The primary array is the markers one as a result of you may add multiple.

Is there a solution to get the primary marker, its lat and lengthy values and save them to separate customized fields when a submit will get saved? Since values can change, I feel probably the most intelligent manner could be to avoid wasting or replace the lat/lengthy fields upon saving a submit. I solely really want the primary marker at any given time.

So the construction that the plugin creates could be like this (map is the customized discipline’s title):

map {
    markers {
        [0] {
            'lat' => '1234',
            'lengthy' => '5678'
        }
    }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments