{"id":15663232,"url":"https://github.com/sc0ttkclark/ghost-meta","last_synced_at":"2025-05-06T10:16:40.613Z","repository":{"id":150472285,"uuid":"90519035","full_name":"sc0ttkclark/ghost-meta","owner":"sc0ttkclark","description":"Ghost meta allows you to store multiple meta values in a single meta record, with an API that mirrors the Metadata API. It integrates with ElasticPress to expand all ghost meta so Elasticsearch can query as normal meta too.","archived":false,"fork":false,"pushed_at":"2020-08-14T03:13:01.000Z","size":16,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T01:23:30.299Z","etag":null,"topics":["elasticpress","metadata","wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sc0ttkclark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"sc0ttkclark","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2017-05-07T08:31:11.000Z","updated_at":"2022-08-28T02:49:36.000Z","dependencies_parsed_at":"2023-07-29T00:46:53.731Z","dependency_job_id":null,"html_url":"https://github.com/sc0ttkclark/ghost-meta","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sc0ttkclark%2Fghost-meta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sc0ttkclark%2Fghost-meta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sc0ttkclark%2Fghost-meta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sc0ttkclark%2Fghost-meta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sc0ttkclark","download_url":"https://codeload.github.com/sc0ttkclark/ghost-meta/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252663635,"owners_count":21784788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elasticpress","metadata","wordpress"],"created_at":"2024-10-03T13:36:03.534Z","updated_at":"2025-05-06T10:16:40.605Z","avatar_url":"https://github.com/sc0ttkclark.png","language":"PHP","funding_links":["https://github.com/sponsors/sc0ttkclark"],"categories":[],"sub_categories":[],"readme":"# Ghost Meta 1.0\n\n## Summary\n\nThis plugin provides functionality to work with a `_ghost_meta` custom field value and be able to function with it as if it were the same as `get_post_meta()` using `get_ghost_meta()`.\n\nIt can hold a ton of extra data which you may not want to clutter up the `wp_postmeta` table with. It also integrates with the core WordPress Metadata API to make it easy for other plugins to interact with it.\n \nIt stores all ghost meta values into one meta key, which saves the number of meta records you may otherwise unnecessarily need to store.\n\n## Example use-case\n\nIf you have millions of posts to import into your app or site, but you don't need to reference the custom fields in filtering or searches -- this can really save you in terms of speed and efficiency.\n\nIf you're using ElasticPress, this can really help you ensure that your ghost meta values will be indexable by Elasticsearch like regular custom fields.\n\nSo what could have easily been 15 million postmeta rows for 15 custom fields on 1 million posts -- is now just 1 million postmeta rows with serialized data stored in each.\n\n## ElasticPress Integration\n\nGhost Meta comes with built-in integration with ElasticPress, so when it indexes your posts it will index your ghost meta just like it would regular custom fields.\n\nTry it out, use `'ep_integrate' =\u003e true` with your WP_Query calls and you'll still get to use `'meta_query'` as you would expect it to work, and it'll be glorious without the mess in your database.\n\n## API\n\n### Get ghost meta\n\n`$meta_value = get_ghost_meta( $object_id, $meta_key, $single );`\n\n### Add ghost meta\n\n`add_ghost_meta( $object_id, $meta_key, $meta_value, $unique );`\n\n### Update ghost meta\n\n`update_ghost_meta( $object_id, $meta_key, $meta_value, $prev_value );`\n\n### Delete ghost meta\n\n`delete_ghost_meta( $object_id, $meta_key, $meta_value, $delete_all );`\n\n### Specifying meta type\n\nBy default, ghost meta uses `post` as the meta type. However, this can be changed using dot-syntax in `$meta_key`.\n\nFor example, you can use `user.my_custom_field` to interact with the `my_custom_field` meta key on the `user` meta type.\n\n### Create custom ghost meta-like functionality\n\nExtend Ghost_Meta and define your own meta type and meta key to store the data in, the code will do the rest. It may help you further separate multiple data stores as needed.\n\n```php\n// Load My Custom Ghost Meta\nadd_action( 'plugins_loaded', array( 'My_Custom_Ghost_Meta', 'get_instance' ), 11 );\n\nclass My_Custom_Ghost_Meta extends Ghost_Meta {\n\n\t/**\n\t * Custom meta type for Ghost meta.\n\t *\n\t * @param string\n\t */\n\tpublic $meta_type = 'my_custom_ghost';\n\n\t/**\n\t * Custom meta key for Ghost meta storage.\n\t *\n\t * @param string\n\t */\n\tpublic $meta_key = '_my_custom_ghost_meta';\n\n}\n```\n\nExample usage: `$meta_value = get_metadata( 'my_custom_ghost', $object_id, $meta_key, $single );`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsc0ttkclark%2Fghost-meta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsc0ttkclark%2Fghost-meta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsc0ttkclark%2Fghost-meta/lists"}