Wordpress Interview Questions

WordPress is a free and open-source content management system (CMS) based on PHP and MySQL.



Wordpress Tables:


wp_commentmeta : This table contains meta information about comments posted on a WordPress website. This table has four fields meta_id, comment_id, meta_key, and meta_value. Each meta_id is related to a comment_id. One example of comment meta information stored is the status of comment (approved, pending, trash, etc).
wp_comments : As the name suggests this table contains your WordPress comments. It contains comment author name, url, email, comment, etc.
wp_links : To manage blogrolls create by earlier versions of WordPress or the Link Manager plugin.
wp_options : This table contains most of your WordPress site wide settings such as: site url, admin email, default category, posts per page, time format, and much much more. The options table is also used by numerous WordPress plugins to store plugin settings.
wp_postmeta : This table contains meta information about your WordPress posts, pages, and custom post types. Example of post meta information would be which template to use to display a page, custom fields, etc. Some plugins would also use this table to store plugin data such as WordPress SEO information.
wp_posts : The name says posts but actually this table contains all post types or should we say content types. This table contains all your posts, pages, revisions, and custom post types.
wp_terms : WordPress has a powerful taxonomy system that allows you to organize your content. Individual taxonomy items are called terms and they are stored in this table. Example, your WordPress categories and tags are taxonomies, and each category and tag inside them is a term.
wp_term_relationships : This table manages relationship of WordPress post types with terms in wp_terms table. For example this is the table that helps WordPress determine post X is in Y category.
wp_term_taxonomy : This table defines taxonomies for terms defined in wp_terms table. For example if you have a term “WordPress Tutorials“, then this table contains the data that says it is associated with a taxonomy categories. In short this table has the data that helps WordPress differentiate between which term is a category, which is a tag, etc.
wp_usermeta : Contains meta information about Users on your website.
wp_users : Contains User information like username, password, user email, etc.


Q.) How to create custom posts?

//custom team
function my_add_team_post() {
    $labels = array(
        'menu_name'    =>'Team'
    );
    $args = array(
        'labels'      => $labels,
        'public'      => true,
        'supports'      => array( 'title', 'thumbnail' ),
        'taxonomies'  => array( 'category', 'post_tag'),
    );
    register_post_type('team', $args);
}
add_action( 'init', 'my_add_team_post');

Q) Get data from custom-firlds..

<?php echo get_post_meta($post->ID,'footer_section_title',true);?>

<?php the_field('under_star_title', 11); ?>


Comments

Popular posts from this blog

PHP Interview Questions