PluginProbe
Extendify / trunk
Extendify vtrunk
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
← All changes | src/Agent/workflows/content/tools/update-post-strings.js +0 -38 3.1.5 → trunk View file →
@@ -20,44 +20,6 @@
20 20 method: 'POST',
21 21 data: { content, title },
22 22 });
23 23
24 - // Also update any active template parts
25 - const slugs = [
26 - ...new Set(
27 - [...document.querySelectorAll('[data-extendify-part-slug]')].map(
28 - (el) => el.dataset.extendifyPartSlug,
29 - ),
30 - ),
31 - ];
32 -
33 - if (slugs.length > 0) {
34 - try {
35 - const allParts = await apiFetch({
36 - path: '/wp/v2/template-parts?per_page=100&context=edit',
37 - });
38 - const activeParts = allParts.filter((p) => slugs.includes(p.slug));
39 - for (const part of activeParts) {
40 - let partContent = part.content.raw;
41 - let changed = false;
42 - for (const { original, updated } of replacements) {
43 - const regex = new RegExp(escapeRegExp(original), 'g');
44 - if (regex.test(partContent)) {
45 - partContent = partContent.replace(regex, updated);
46 - changed = true;
47 - }
48 - }
49 - if (changed) {
50 - await apiFetch({
51 - path: `/wp/v2/template-parts/${part.id}`,
52 - method: 'POST',
53 - data: { content: partContent },
54 - });
55 - }
56 - }
57 - } catch {
58 - // Template parts API may not be available, continue
59 - }
60 - }
61 -
62 24 return postResult;
63 25 };