I am using this rewrite rule function but it does not work in child theme. It seems not going inside callback function at all.
function add_rewrite_rules($aRules) {
$term_obj = get_queried_object();
//print_r($term_obj);
if(isset($term_obj->term_id) && $term_obj->term_id!=""){
$aNewRules = array('casselberry-antique-white/([^/]+)/?$' => 'templates/product-list-template.php?manufacturer_id=$matches[1]');
$aRules = $aNewRules + $aRules;
return $aRules;
}
else{
return $aRules;
}
}
2
Answers
Instead of isset try using property_exists
see: https://www.php.net/manual/en/function.property-exists.php
When you call add_rewrite_rules function?
You need init hook, add_rewrite_rule is a function core WordPress see link