Functions.php added code not working

Vi ER konsulenter
15 Posts
Vi ER konsulenter posted this 15 November 2017

Hello,

I have the plugin client portal. I wanted my users to get an email when I update their private page, so I asked the developer of the plugin. I can add the following code to my functions.php:

//Send an email to the user when his private page was updated 
function cpc_send_email_on_page_update($post_id) {
$author_id = get_post_field('post_author', $post_id);

$user = get_userdata($author_id);
$to = $user->user_email;
$site_name = get_bloginfo('name');

$subject = '['.$site_name.'] Private page updated !';
$message = 'Your private page was just updated !';

wp_mail($to, $subject, $message);
}
add_action( 'save_post_private-page', 'cpc_send_email_on_page_update' );

When I activate the twenty seventeen theme the extra code in the functions.php works fine. But when I activate the Themler theme I made, it does not work.

I added the code in the functions.php of both the Twenty Seventeen theme and my Themler theme.

Does anyone know what can be the problem?

Hello, I have the plugin client portal. I wanted my users to get an email when I update their private page, so I asked the developer of the plugin. I can add the following code to my functions.php: //Send an email to the user when his private page was updated function cpc_send_email_on_page_update($post_id) { $author_id = get_post_field('post_author', $post_id); $user = get_userdata($author_id); $to = $user->user_email; $site_name = get_bloginfo('name'); $subject = '['.$site_name.'] Private page updated !'; $message = 'Your private page was just updated !'; wp_mail($to, $subject, $message); } add_action( 'save_post_private-page', 'cpc_send_email_on_page_update' ); When I activate the twenty seventeen theme the extra code in the functions.php works fine. But when I activate the Themler theme I made, it does not work. I added the code in the functions.php of both the Twenty Seventeen theme and my Themler theme. Does anyone know what can be the problem?
Vote to pay developers attention to this features or issue.
18 Comments
Order By: Standard | Newest
Support Team
Support Team posted this 15 November 2017

Hi,

Did you try adding the code to the Themler Settings >> CMS Code?
This is the proper place to add custom php and usually everything work ok.

Thank you,
Olivia

Hi, Did you try adding the code to the Themler Settings >> CMS Code? This is the proper place to add custom php and usually everything work ok. Thank you, Olivia
Vi ER konsulenter
15 Posts
Vi ER konsulenter posted this 15 November 2017

I did not try that, but I did just now.

I get an error saying it is unrecognised code.

I did not try that, but I did just now. I get an error saying it is unrecognised code.
Support Team
Support Team posted this 15 November 2017

Hi,

I've tried to add it to the WP theme on my side and it does not return any error messages. Are you sure that you added it exactly into the CMS Code field?

Thank you,
Olviia

Hi, I've tried to add it to the WP theme on my side and it does not return any error messages. Are you sure that you added it exactly into the CMS Code field? Thank you, Olviia
Vi ER konsulenter
15 Posts
Is Solution
Vi ER konsulenter posted this 15 November 2017

Thnx Olivia, that was the problem, I accidentaly used the field for extra CSS in stead of CMS code.

I managed to get the code in and the code is also working.

Thnx Olivia, that was the problem, I accidentaly used the field for extra CSS in stead of CMS code. I managed to get the code in and the code is also working.
Support Team
Support Team posted this 16 November 2017

Hi,

Great!
Please let us know if you have any other questions/issues.

Thank you,
Olivia

Hi, Great! Please let us know if you have any other questions/issues. Thank you, Olivia
alexturkonline
1 Posts
alexturkonline posted this 22 March 2025

It sounds like a theme-related conflict! Since the code works fine in Twenty Seventeen but not in Themler, the issue might be with how Themler handles post updates or custom hooks. Check if ESS Utumishi Portal or any other plugin in your setup interferes with save_post_private-page. Also, ensure functions.php in Themler is correctly executed. Adding error_log('Function triggered'); inside cpc_send_email_on_page_update might help debug if the function runs at all. Hope this helps!

It sounds like a theme-related conflict! Since the code works fine in Twenty Seventeen but not in Themler, the issue might be with how Themler handles post updates or custom hooks. Check if [ESS Utumishi Portal][1] or any other plugin in your setup interferes with save_post_private-page. Also, ensure functions.php in Themler is correctly executed. Adding error_log('Function triggered'); inside cpc_send_email_on_page_update might help debug if the function runs at all. Hope this helps! [1]: https://essutumishiportal.co.tz/
woordnelson6
1 Posts
woordnelson6 posted this 29 July 2025

The issue likely lies in your Themler theme—it may not be firing the save_post_private-page hook properly, or it overrides default behaviors. Try checking if functions.php is loading correctly or if custom post types are used.

Just like choosing reliable online CPC evening courses, theme compatibility matters functionality depends on the right setup.

The issue likely lies in your Themler theme—it may not be firing the save_post_private-page hook properly, or it overrides default behaviors. Try checking if functions.php is loading correctly or if custom post types are used. Just like choosing reliable [online CPC evening courses][1], theme compatibility matters functionality depends on the right setup. [1]: https://www.cpctraining.org/
ahsansahab150
2 Posts
ahsansahab150 posted this 03 March 2026

Minecraft keeps evolving with frequent "game drops" and patches. The Minecraft 26.0 patch (also known as Bedrock Edition 1.26.0), released February 10, 2026, marks a major milestone as the first update under Mojang's new year-based versioning system. Versions in 2026 start with "26" for both Bedrock and Java Editions, making updates easier to track Minecraft Patch Download.

Minecraft keeps evolving with frequent "game drops" and patches. The Minecraft 26.0 patch (also known as Bedrock Edition 1.26.0), released February 10, 2026, marks a major milestone as the first update under Mojang's new year-based versioning system. Versions in 2026 start with "26" for both Bedrock and Java Editions, making updates easier to track [Minecraft Patch Download][1]. [1]: https://sites.google.com/view/minecraftpatchdownload/home
ksarestaurantsz
2 Posts
ksarestaurantsz posted this 07 March 2026

The issue is likely related to how the WordPress theme handles the save_post_private-page action. Some themes (including themes created with Themler) may override or not properly trigger certain hooks.

A better solution is to use the general save_post hook and then check the post type inside the function.

The issue is likely related to how the WordPress theme handles the save_post_private-page action. Some themes (including themes created with Themler) may override or not properly trigger certain hooks. A better solution is to use the general save_post hook and then check the post type inside the [function.][1] [1]: https://ksarestaurantsz.com/%D8%A7%D9%82%D8%B1%D8%A8-%D9%85%D8%B7%D8%B9%D9%85-%D9%85%D9%86-%D9%85%D9%88%D9%82%D8%B9%D9%8A/

Last edited 07 March 2026 by ksarestaurantsz

adilarshad475
1 Posts
adilarshad475 posted this 19 March 2026

It sounds like a theme-related conflict! Since the code works fine in Twenty Seventeen but not in Themler, the issue might be with how Themler handles post updates or custom hooks. Check if [ESS Utumishi Portal][1] or any other plugin in your setup interferes with save_post_private-page. Also, ensure functions.php in Themler is correctly executed. Adding error_log('Function triggered'); inside cpc_send_email_on_page_update might help debug if the function runs at all. Hope this helps!

[1]: https://essutumishiportal.co.tz/

https://szgames.io/

> It sounds like a theme-related conflict! Since the code works fine in Twenty Seventeen but not in Themler, the issue might be with how Themler handles post updates or custom hooks. Check if [ESS Utumishi Portal][1] or any other plugin in your setup interferes with save_post_private-page. Also, ensure functions.php in Themler is correctly executed. Adding error_log('Function triggered'); inside cpc_send_email_on_page_update might help debug if the function runs at all. Hope this helps! > > > [1]: https://essutumishiportal.co.tz/ https://szgames.io/
buyfolloweruk
3 Posts
buyfolloweruk posted this 19 March 2026

Many platforms offer easy registration for new users. Players can create an account within a few steps and start playing instantly. To continue to the next step, you can click here and complete the signup process without confusion. Clear instructions guide users properly. This helps save time and effort. Simple steps improve user experience.
https://teenpattiboss.com.pk/

Many platforms offer easy registration for new users. Players can create an account within a few steps and start playing instantly. To continue to the next step, you can click here and complete the signup process without confusion. Clear instructions guide users properly. This helps save time and effort. Simple steps improve user experience. https://teenpattiboss.com.pk/
muhammadgullsher0303
1 Posts
muhammadgullsher0303 posted this 03 April 2026

Minecraft keeps evolving with frequent "game drops" and patches. The Minecraft 26.0 patch (also known as Bedrock Edition 1.26.0), released February 10, 2026, marks a major milestone as the first update under Mojang's new year-based versioning system. Versions in 2026 start with "26" for both Bedrock and Java Editions, making updates easier to track [Minecraft Patch Download][1].

[1]: https://sites.google.com/view/minecraftpatchdownload/home

https://pizzaedition-net.github.io/

> Minecraft keeps evolving with frequent "game drops" and patches. The Minecraft 26.0 patch (also known as Bedrock Edition 1.26.0), released February 10, 2026, marks a major milestone as the first update under Mojang's new year-based versioning system. Versions in 2026 start with "26" for both Bedrock and Java Editions, making updates easier to track [Minecraft Patch Download][1]. > > > [1]: https://sites.google.com/view/minecraftpatchdownload/home https://pizzaedition-net.github.io/
saqibkhan5557861
1 Posts
saqibkhan5557861 posted this 16 April 2026

It sounds like a theme-related conflict! Since the code works fine in Twenty Seventeen but not in Themler, the issue might be with how Themler handles post updates or custom hooks. Check if [ESS Utumishi Portal][1] or any other plugin in your setup interferes with save_post_private-page. Also, ensure functions.php in Themler is correctly executed. Adding error_log('Function triggered'); inside cpc_send_email_on_page_update might help debug if the function runs at all. Hope this helps!

[1]: https://essutumishiportal.co.tz/

https://szgames.io/

also check here all games: https://szgames.site

> > It sounds like a theme-related conflict! Since the code works fine in Twenty Seventeen but not in Themler, the issue might be with how Themler handles post updates or custom hooks. Check if [ESS Utumishi Portal][1] or any other plugin in your setup interferes with save_post_private-page. Also, ensure functions.php in Themler is correctly executed. Adding error_log('Function triggered'); inside cpc_send_email_on_page_update might help debug if the function runs at all. Hope this helps! > > > > > > [1]: https://essutumishiportal.co.tz/ > > https://szgames.io/ also check here all games: https://szgames.site
abdulsattar325555
1 Posts
abdulsattar325555 posted this 19 April 2026

It sounds like a theme-related conflict! Since the code works fine in Twenty Seventeen but not in Themler, the issue might be with how Themler handles post updates or custom hooks. Check if [ESS Utumishi Portal][1] or any other plugin in your setup interferes with save_post_private-page. Also, ensure functions.php in Themler is correctly executed. Adding error_log('Function triggered'); inside cpc_send_email_on_page_update might help debug if the function runs at all. Hope this helps!

[1]: https://essutumishiportal.co.tz/

https://szgames.io/

also check here all games: https://szgames.site

for more info: https://szgames.org

> > > It sounds like a theme-related conflict! Since the code works fine in Twenty Seventeen but not in Themler, the issue might be with how Themler handles post updates or custom hooks. Check if [ESS Utumishi Portal][1] or any other plugin in your setup interferes with save_post_private-page. Also, ensure functions.php in Themler is correctly executed. Adding error_log('Function triggered'); inside cpc_send_email_on_page_update might help debug if the function runs at all. Hope this helps! > > > > > > > > > [1]: https://essutumishiportal.co.tz/ > > > > https://szgames.io/ > > also check here all games: https://szgames.site for more info: https://szgames.org
zahidali8805525
1 Posts
zahidali8805525 posted this 31 May 2026

It sounds like a theme-related conflict! Since the code works fine in Twenty Seventeen but not in Themler, the issue might be with how Themler handles post updates or custom hooks. Check if [ESS Utumishi Portal][1] or any other plugin in your setup interferes with save_post_private-page. Also, ensure functions.php in Themler is correctly executed. Adding error_log('Function triggered'); inside cpc_send_email_on_page_update might help debug if the function runs at all. Hope this helps!

[1]: https://essutumishiportal.co.tz/

https://szgames.io/

also check here all games: https://szgames.site

for more info: https://szgames.org

https://pizzaedition-games.com

> > > > It sounds like a theme-related conflict! Since the code works fine in Twenty Seventeen but not in Themler, the issue might be with how Themler handles post updates or custom hooks. Check if [ESS Utumishi Portal][1] or any other plugin in your setup interferes with save_post_private-page. Also, ensure functions.php in Themler is correctly executed. Adding error_log('Function triggered'); inside cpc_send_email_on_page_update might help debug if the function runs at all. Hope this helps! > > > > > > > > > > > > [1]: https://essutumishiportal.co.tz/ > > > > > > https://szgames.io/ > > > > also check here all games: https://szgames.site > > for more info: https://szgames.org https://pizzaedition-games.com
muqeemsa.com
1 Posts
muqeemsa.com posted this 18 June 2026

It looks like the code itself is generally fine, but there are a few things worth checking.

First, make sure private-page is actually the correct custom post type slug used by the plugin. If the slug is different, the save_post_private-page hook won't fire.

Also, if you're using a child theme, confirm that you've added the code to the active theme's functions.php. Sometimes changes are made to the wrong theme file.

Another thing to verify is whether wp_mail() is working correctly on your WordPress site. A quick test with an email logging plugin can help determine if emails are being sent or if there's a mail configuration issue.

If everything above checks out, it may be worth asking the plugin developer whether they provide their own action hook when a private page is updated. Plugin-specific hooks are often more reliable than the generic save_post hook.

Hope you get it working soon!
https://muqeemsa.com/

It looks like the code itself is generally fine, but there are a few things worth checking. First, make sure **`private-page`** is actually the correct custom post type slug used by the plugin. If the slug is different, the `save_post_private-page` hook won't fire. Also, if you're using a child theme, confirm that you've added the code to the active theme's `functions.php`. Sometimes changes are made to the wrong theme file. Another thing to verify is whether `wp_mail()` is working correctly on your WordPress site. A quick test with an email logging plugin can help determine if emails are being sent or if there's a mail configuration issue. If everything above checks out, it may be worth asking the plugin developer whether they provide their own action hook when a private page is updated. Plugin-specific hooks are often more reliable than the generic `save_post` hook. Hope you get it working soon! https://muqeemsa.com/
azharshah153624
1 Posts
azharshah153624 posted this 3 weeks ago

If the code in functions.php isn't working, check for syntax errors, make sure it's added to the active theme, and clear any caches. I also like reading reliable information about قطار الحرمين السريع because clear details make planning much easier.

If the code in functions.php isn't working, check for syntax errors, make sure it's added to the active theme, and clear any caches. I also like reading reliable information about [قطار الحرمين السريع][1] because clear details make planning much easier. [1]: https://haramaintrainsa.net/
zaincreater804
1 Posts
zaincreater804 posted this 2 weeks ago

Code added to functions.php may not work due to syntax errors, theme conflicts, or incorrect hook placement.
Check for PHP errors, clear your cache, and ensure the code is compatible with your WordPress version and active theme.
Live Tracking helps businesses monitor shipments, vehicles, and assets with accurate real-time updates.

Code added to functions.php may not work due to syntax errors, theme conflicts, or incorrect hook placement. Check for PHP errors, clear your cache, and ensure the code is compatible with your WordPress version and active theme. [Live Tracking][1] helps businesses monitor shipments, vehicles, and assets with accurate real-time updates. [1]: https://livetrackingpk.github.io/
You must log in or register to leave comments