admin管理员组文章数量:1425006
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
1 Answer
Reset to default 1Options 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()
.
本文标签: custom fieldper blog metadata for plugin
版权声明:本文标题:custom field - per blog metadata for plugin 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745414741a2657631.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论