The “ims_rewrite_rules” filter is used to modify/extend the image store rewrites. Be careful modifying the rules, it could also affect other rules. Hook works with the WordPress  generate_rewrite_rules hook.

A plugin (or theme) can modify the array with the code:

<?php add_filter( 'ims_rewrite_rules', 'filter_function_name' ); ?>

The hook is located in the image-store/_inc/core.php file.


// Apply filter
function modify_ims_rewrite_rules( $rules ) {
	$new_rules["(.?.+?)/user/?$"] = "index.php?pagename=" . $wp_rewrite->preg_index( 1 ) . "&imspage=user"; // add a rule for user pages
	return $rules; 
add_filter('ims_rewrite_rules', 'modify_ims_rewrite_rules');

Note:  $rules is an multidimensional array. View the WordPress WP_Rewrite class for more information.

Leave a Reply

Your email address will not be published. Required fields are marked *