WordPress Plugin Development: final quiz

Twelve questions covering the whole WordPress Plugin Development course.

  • Intermediate
  • 12 questions

12 questions. Pass mark 70%.

  1. Question 1 of 12 A user deletes your plugin from the Plugins screen and has opted in to removing its data. Where should the code that drops the bookings table run?
  2. Question 2 of 12 Your settings page form posts to options.php. Which call prints the hidden fields that tell WordPress which settings group is being saved, including the nonce?
  3. Question 3 of 12 Editors report that this shortcode’s output appears at the top of the post instead of where they placed it. Why?
    PHP
    add_shortcode( 'myplugin_price', 'myplugin_price_shortcode' );
    
    function myplugin_price_shortcode( $atts ) {
    	echo '<span class="price">£20</span>';
    }
  4. Question 4 of 12 Version 1.2 of your plugin changes the bookings table. Which change will dbDelta() not make for you?
  5. Question 5 of 12 Any logged-in subscriber can use this AJAX handler to confirm bookings. What is missing?
    PHP
    add_action( 'wp_ajax_myplugin_confirm', 'myplugin_ajax_confirm' );
    
    function myplugin_ajax_confirm() {
    	check_ajax_referer( 'myplugin_confirm', 'nonce' );
    
    	$id = absint( $_POST['booking_id'] ?? 0 );
    	myplugin_set_booking_status( $id, 'confirmed' );
    
    	wp_send_json_success();
    }
  6. Question 6 of 12 You need to send reminder emails for 20,000 bookings. Which two are real advantages of queuing the work with Action Scheduler rather than one large WP-Cron callback?

    Select all that apply.

  7. Question 7 of 12 Your plugin hosts its own updates. Which filter lets it add its newer version to the data WordPress uses to show “update available”?
  8. Question 8 of 12 Your plugin ships a dynamic block whose block.json declares a render file. Where does its front-end HTML come from?
  9. Question 9 of 12 What does the header line Requires Plugins: woocommerce do in current versions of WordPress?
  10. Question 10 of 12 Two plugins on a site bundle different versions of the same Composer library under the same namespace. What usually happens?
  11. Question 11 of 12 Version 2.0 of your plugin must convert stored data. Users update by uploading the new version or through automatic updates. Where should the upgrade routine be triggered?
  12. Question 12 of 12 A plugin saves a 3 MB activity log with update_option( 'myplugin_log', $log ), and the option ends up autoloaded. What is the main effect?