allow subscribers to see private posts without plug in

This can be added as a basic hook – function what-ever-youwantto-callthis() { $subRole = get_role( ‘subscriber’ ); //change the name of the user here $subRole->add_cap( ‘read_private_posts’ ); //allows the above to read posts $subRole->add_cap( ‘read_private_pages’ ); //allows the above to read pages } add_action( ‘init’, ‘what-ever-youwantto-callthis’ );

Using file_get_contents with Gravity Forms uploads folder to create images in the media library returning false

I noticed in your comment… Return the uploaded image ID, so to use to update the ACF field Here is two functions which may help you out… gf_handle_attachments() to handle converting gform submission image file into wordpress media attachment. Returning media (attachment) id. gf_upload_to_media_acf() to handle gform submitted image or multiple images and update defined … Read more

wp_is_mobile dequeue not working

It looks like you are using the script “src” rather than the script “handle”. Have you tried: add_action( ‘wp_enqueue_scripts’, ‘remove_plugin_scripts’, PHP_INT_MAX ); function remove_plugin_scripts() { if ( wp_is_mobile() ) { // Remove script file. wp_dequeue_script( ‘tp-tools’ ); wp_deregister_script( ‘tp-tools’ ); wp_dequeue_script( ‘revmin’ ); wp_deregister_script( ‘revmin’ ); } }

How do I display a user’s previous orders as a select box option on a product?

You can try something like this: add_action( ‘woocommerce_before_add_to_cart_form’, ‘add_list_completed_orders’ ); function add_list_completed_orders() { // get orders $orders = wc_get_orders ( array ( ‘status’ => array( ‘wc-completed’ ), ‘type’ => ‘shop_order’, ‘limit’ => -1, ‘return’ => ‘ids’, ‘customer_id’ => get_current_user_id(), ) ); if ( ! empty( $orders ) ) { // set value options $options=””; foreach … Read more

Replace menu links with # and add name to its li

I want the URLs of the nav-items to be replaced with # You can use the nav_menu_link_attributes hook to set the custom href value like so: add_filter( ‘nav_menu_link_attributes’, function ( $atts, $item, $args ) { if ( ‘menu-categorias’ === $args->theme_location && ‘category’ === $item->object ) { $atts[‘href’] = ‘#’ . get_term_field( ‘slug’, $item->object_id ); } … Read more

Redirect specific page in WordPress for first time visit

I would always hook it to template_redirect. Something like this: add_action( ‘template_redirect’, ‘custom_check_for_redirect’ ); function custom_check_for_redirect(){ global $wp_query; # It could work without this too! if( is_page( 8219 ) ) $days_to_expire = 30; if (!is_admin() && !isset($_COOKIE[‘already_visited’])) { setcookie(‘already_visited’, true, time() + 86400 * $days_to_expire); wp_redirect(home_url(‘/welkom’), 302); exit; }; };

is_account_page() change to page slug

You could try to use the is_page() function – https://developer.wordpress.org/reference/functions/is_page/ The function signature accepts one parameter – $page (int|string|int[]|string[]) (Optional) Page ID, title, slug, or array of such to check against. Default value: ” if ( is_page(‘account’) ){ // do some code here }