Home | About | Web Stories | View All Posts

16 Dec 2018

Wordpress Interview Questions and Answers

Wordpresss is the most popular open source content management system(cms). It is used for more than 50 million websites. Below are the list of frequently asksed wordpress plugin developement questions and answers.


Q. - Which function is used for avoiding the SQL injection in Wordpress for performing query to database table.
Ans. - The method 'prepare' is used to avoid SQL injection or an illegal operation or any illegal characters. It uses query with placeholders and additional arguments to replace that placeholders.

For example - Delete the 'FeatureImage' meta key and value from Post 12.
$wpdb->query(
$wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s", 12, 'FeatureImage')
);

Q. - How to know which user has placed which order in Woocommerce database via phpmyadmin
Ans. -
Go at wordpress users table and find user id value. Search the user id in wordpress postmeta table in meta_value field. You will get _customer_user = user_id alongwith post_id.

Finally You need to search this post_id into wp_woocommerce_order_items table in order_id field.

You will get the product name as order_item_name that the user have purchased or ordered.

Please note - User order is stored in post table using post_type is equal to shop_order.

Tags : ,
Aashutosh Kumar Yadav

By Aashutosh Kumar Yadav

He is a PHP-based UI/Web designer and developer by profession and very interested in technical writing and blogging. He has been writing technical content for about 10 years and has proficient in practical knowledge and technical writing.
@www.infotokri.in

0 comments:

Post a Comment