Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gdarko authored Aug 17, 2022
1 parent 8e52e83 commit f58874c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ $framework->register_settings( array( $settings ) ); // Note: $settings one grou

To retrieve options for the above settings, locate the settings key, in our case `custom_options`.

```
```php
// Make settings instance
$settings = get_option('custom_options');

Expand Down Expand Up @@ -252,13 +252,15 @@ $framework->register_metabox( array(

To retrieve the metabox settings, use get_post_meta() function as follows.

```
```php
$value = get_post_meta($post_id, 'demo_text', true);
```

If you are using `'save_mode' => 'array'` in the metabox settings, then all the settings will be stored into one meta row as serialized array. To retrieve with this kind of save mode, call the get_post_meta() function on the metabox id as follows:
If you are using `'save_mode' => 'array'` in the metabox settings, then all the settings will be stored into one meta row as serialized array. This appraoch is good if you want better performance. The data will be accessible with one mysql query instead of separate for each field.

```
To retrieve with this kind of save_mode, call the get_post_meta() function on the metabox id as follows:

```php
$data = get_post_meta($post_id, 'demo_meta_box', true);
$value = $data['demo_text'];
```
Expand Down

0 comments on commit f58874c

Please sign in to comment.