WordPress::DBIC::Schema - Database schema for WordPress
This is a basic schema (and mostly a work in progress) for the WordPress database, which can be used for migrations, data fetching etc.
It comes with some relationships even if the DB doesn't implement them with foreign keys.
my $schema = WordPress::DBIC::Schema->connect('wordpress'); foreach my $id (@ARGV) { if (my $post = $schema->resultset('WpPost')->published ->find($id, { prefetch => ['metas', { wp_term_relationships => { wp_term_taxonomy => 'wp_term' } }], })) { foreach my $taxonomy ($post->taxonomies) { print $post->post_title . ' ' . $taxonomy->wp_term->name . "\n"; } print $post->clean_url . "\n"; print $post->permalink . "\n"; foreach my $meta ($post->metas) { if ($meta->meta_key eq 'subtitle') { print $meta->meta_value . "\n"; } } print $post->html_body . "\n"; } }
Marco Pessotto, <melmothx at gmail.com>
<melmothx at gmail.com>
Please report any bugs or feature requests to the author's email or just use the CPAN's RT.
This module is free software and is published under the same terms as Perl itself.
To install WordPress::DBIC::Schema, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WordPress::DBIC::Schema
CPAN shell
perl -MCPAN -e shell install WordPress::DBIC::Schema
For more information on module installation, please visit the detailed CPAN module installation guide.