custom field - per blog metadata for plugin

I wish to have my plugin store metadata for each blog in a network (or just one if single site install). Most of the Goo

I wish to have my plugin store metadata for each blog in a network (or just one if single site install). Most of the Google results are for post_meta and user_meta but I really need site_meta which does not appear to be the same (only a get method). The data is generally going to be of the form:

$metadata['this']['foo'] = 'something';
$metadata['this']['bar'] = 'one thing';
$metadata['that']['foo'] = 'mum';
$metadata['that']['bar'] = 'dad';

What is the best way to store this?

I wish to have my plugin store metadata for each blog in a network (or just one if single site install). Most of the Google results are for post_meta and user_meta but I really need site_meta which does not appear to be the same (only a get method). The data is generally going to be of the form:

$metadata['this']['foo'] = 'something';
$metadata['this']['bar'] = 'one thing';
$metadata['that']['foo'] = 'mum';
$metadata['that']['bar'] = 'dad';

What is the best way to store this?

Share Improve this question edited Jun 10, 2019 at 10:41 Matthew Brown aka Lord Matt asked Jun 10, 2019 at 10:34 Matthew Brown aka Lord MattMatthew Brown aka Lord Matt 1,0683 gold badges13 silver badges34 bronze badges 2
  • 3 Options are site specific, so you just need to use update_option() and get_option(). – Jacob Peattie Commented Jun 10, 2019 at 11:42
  • That is exactly what I needed. If you wrote it up as an answer... – Matthew Brown aka Lord Matt Commented Jun 11, 2019 at 10:36
Add a comment  | 

1 Answer 1

Reset to default 1

Options are site specific, so you just need to use update_option() and get_option().

The network-wide equivalents are update_network_option() and get_network_option(). Note that update_site_option() is just a wrapper for update_network_option(), and is an older name from when a multisite network was (confusingly) called a 'site'. The same applies for get_site_option().

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745414742a4626695.html

相关推荐

  • custom field - per blog metadata for plugin

    I wish to have my plugin store metadata for each blog in a network (or just one if single site install). Most of the Goo

    3小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信