Find-Replace not working in a certain scenario
-
Hi,
I found a case where find/replace does not work and I might have also found the cause of the bug. I’ll try to explain this with an example.
e.g.
postname default URI: /fruits/apples/abc
assument ‘apple’ is a parent page of ‘abc’
post_type: ‘fruits’If the following permastruct is added after the posts have been created
permastruct: /fruits/%postname_flat%Find/replace of custom URI does not change any URIs (API response says ‘No slugs were updated’)
find: ‘fruits/apples/’
replace_with: ‘fruits/’The following piece of code in
function get_default_post_uriincorrectly returns the default URI as /fruits/abc (even though it’s presently /fruits/apple/abc)$default_permastruct = Permalink_Manager_Helper_Functions::get_default_permastruct($post_type); if($native_uri) { $permastruct = $default_permastruct; } else { $permastruct = (isset($permalink_manager_permastructs['post_types'][$post_type])) ? $permalink_manager_permastructs['post_types'][$post_type] : $default_permastruct; }which prevents
function find_and_replacefrom working as expected as ($old = $default_uri == $new_uri)
Screenshot: https://i.imgur.com/oJLSHbp.png
The topic ‘Find-Replace not working in a certain scenario’ is closed to new replies.