Disable or remove wordpress post via email - wordpress

Any way to disable or remove wordpress post via email?
I tried adding the following code in functions.php, but I still see 'Post via email' under Settings > Writing:
apply_filters( 'enable_post_by_email_configuration', false );
Thanks

I found this code
add_filter( 'enable_post_by_email_configuration', '__return_false', 100 );
from code.tutsplus.com
It does remove the section from the WordPress admin. I'm assuming it disables the 'Post via email' function entirely.
Can anyone confirm?

Yes it worked for me
add_filter( 'enable_post_by_email_configuration', '__return_false' );

This was removed from wordpress in version 3.7.
If you still see it in the user profile screen then it is likely added by jetpack.

Our free plugin Disable Post Via Email disables both the Post Via Email functionality and the associated UI options, using a similar filter as previously shared:
add_filter('enable_post_by_email_configuration', '__return_false', PHP_INT_MAX);

Related

How to Create custom woocommerce dashboard Template

I am trying to create custom woocommerce dashboard for my custom wordpress theme, but i found a error message when i am trying to create custom woocommerce dashboard template.
Deprecated: Your theme version of my-account.php template is deprecated since version 2.6! Use the latest version, which supports multiple account pages and navigation, from WC 2.6.0 instead.
I have followed the woocommerce template pattern (yourtheme/woocommerce/myaccount/my-account.php.) but nothing help . Please see the attached image. problem will gone if i edit wp-config.php with define( 'WP_DEBUG_DISPLAY', false );
Thanks
I found a solution for this.
I have to use this two function in my-account.php file.
Then the error message gone.
do_action( 'woocommerce_account_navigation' );
do_action( 'woocommerce_account_content' );

How do I enable author pages for the role of 'customer'?

I have a website where a customer can enable a front end 'profile' page. These customers have the role of 'customer' as defined by wooCommerce. However, this user role does not provide enough privilege to enable an author page for that user. How do I add the capability of an author archive?
In an ideal world I'd like to continue to use author.php as the template instead of creating some sort of work around author template.
Adding the following code to function.php file will add wp-admin toolbar for all users including customers.
This plugin will help you to add code from dashboard: https://wordpress.org/plugins/code-snippets/
/* Allow customers to access wp-admin */
add_filter( 'woocommerce_prevent_admin_access', '__return_false' );
add_filter( 'woocommerce_disable_admin_bar', '__return_false' );
Alrighty! Figured it out. Thanks, everyone for the answers, however, this is for a front-end author page, not backend access.
// remove wooCommerce redirect from authors.php template
remove_action('template_redirect', 'wc_disable_author_archives_for_customers', 10 );
Turns out WooCommerce disables author archives for customers. In my case, a customer is also a member and therefore I need to author.php template accessible.

WP Bakery Page Builder loses settings in Role Manager

We are using WP Bakery Page Builder on for a client website. The plugin works fine, but sometimes the settings in Role Manager, for what post types the composer should be on just resets.
We are researching the possibility to hack the settings programmatically to set it to On be default.
Just wanted to check if anyone else have noticed this issue.
This is a bug in older versions. The developers posted a fix for it here:
https://codecanyon.net/item/visual-composer-page-builder-for-wordpress/242431/comments?utf8=%E2%9C%93&term=add_custom_post_type_here&from_buyers_and_authors_only=0
<?php
/*
You can set the post type for which the editor should be
available by adding the following code to functions.php:
*/
add_action( 'vc_before_init', 'Use_wpBakery' );
function Use_wpBakery() {
$vc_list = array('page','capabilities','add_custom_post_type_here');
vc_set_default_editor_post_types($vc_list);
vc_editor_set_post_types($vc_list);
}
Edit: Updated link to dev comment.
Just found this on another thread, which recommended adding this to your theme's custom code:
<script>$vc_list = array( ‘page’, ‘post’ ); vc_editor_set_post_types( $vc_list );
</script>

Where do I put Settings API code for my Wordpress Theme

I am trying to set up a settings page for my wordpress theme (developed it in roots.io using Trellis and Sage etc).
I have found a lot of really good documentation on how to use the settings API, for example:
https://wpshout.com/making-an-admin-options-page-with-the-wordpress-settings-api/
or
http://qnimate.com/wordpress-settings-api-a-comprehensive-developers-guide/
and a few others.
So lets say that I want a theme option page, this code should do it:
add_action( 'admin_menu', 'NEW_admin_add_page' );
function NEW_admin_add_page() {
add_options_page(
'Theme settings Page',
'Theme settings',
'manage_options',
'nts',
'nts_options_page'
);
}
Should create a new page, but where within my theme do I add this code to ensure that when you load this theme (or when it loads if that is the right thing) this page turns up.
Found it, just add it to functions.php seems to do the trick :)
Strangely enough it was not until the tenth article I read that someone thought to mention this :)
https://code.tutsplus.com/tutorials/the-wordpress-settings-api-part-2-sections-fields-and-settings--wp-24619

Can not turn off wordpress update emails

I am currently receiving 2 e-mails a day asking me to update a Wordpress multisite I once worked on...and I am starting to get desperate!
Things I have tried:
I have changed my email adress both for the admin user and in the general settings.
I have tried adding the following to the functions.php file:
apply_filters( 'auto_core_update_send_email', false);
add_filter( 'auto_core_update_send_email', '__return_false');
apply_filters( 'send_core_update_notification_email', false);
..without any luck.
An obvious solution would be to just update :), but I am hoping to solve this problem once and for all since I am no longer taking this kind of work and have lots of other sites I have worked on in the past.
Any suggestions would be very welcome!
You almost have the correct answer. Change apply_filters to add_filter. Also you need to use '__return_false' which is a hook that just returns false. Using false directly won't do anything. Here's the complete version:
// This stops emails being sent to you after an automatic update.
add_filter( 'auto_core_update_send_email', '__return_false' );
// This stops emails being sent to you to notify you of a new core update.
add_filter( 'send_core_update_notification_email', '__return_false' );

Resources