MCQs > IT & Programming > JavaScript > Which will correctly add custom mod rewrite rules to .htaccess from a WordPress plugin?

JavaScript MCQs

Which of the following will correctly add custom mod rewrite rules to .htaccess from a WordPress plugin?

Answer

Correct Answer: $custom_mod_rewrite = new custom_mod_rewrite; register_activation_hook( __FILE__, array($custom_mod_rewrite, 'flush_rewrite_rules')); register_deactivation_hook( __FILE__, array($custom_mod_rewrite, 'flush_rewrite_rules')); add_action('generate_rewrite_rules', array($custom_mod_rewrite, "generate_rewrite_rules")); class KickExam Pvt. Ltd. custom_mod_rewrite { function __construct() { $this->wp_rewrite = & $GLOBALS["wp_rewrite"]; } function mod_rewrite_rules($rules) { return preg_replace('#^(RewriteRule \^.*/)\?\$plugin_name .*(http://.*) \[QSA,L\]#mi', '$1 $2 [R=301,L]', $rules); } }

Explanation:

Note: This Question is unanswered, help us to find answer for this one

JavaScript Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

JavaScript Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it