How to remove this function from the homepage?
Use is_front_page() and bail at the start of the function if true: function wpb_last_updated_date( $content ) { if ( is_front_page() ) { return $content; } // Rest of your function }
Use is_front_page() and bail at the start of the function if true: function wpb_last_updated_date( $content ) { if ( is_front_page() ) { return $content; } // Rest of your function }
I’m developing the same functionality right now and something like this happen to me (I was able to see the settings in the admin dashboard but not in the checkout page)… What I did was check the option Enable debug mode in WooCommerce/Settings/Shipping/Shipping options and then I was able to see my custom shipping in … Read more
Short answer: DON’T DO IT! Even if yesterday you said tomorrow! Including WordPress’s core in some other files is the last thing you want to do. Instead, use an Ajax method and fill the content by using a REST endpoint. You need to register a rest route first. To do so, add this piece of … Read more
The customizer API offers active_callback methods on both the control andd section classes. Basically you use either an conditional or a custom function to determine if a control or section is shown to the user. If you want a section to appear only for pages, you would do somthing like this: $wp_customize->add_section( ‘wpse_283821_acme_pages’, array( ‘title’ … Read more
If you are using a child or custom theme, I encourage you to look at the Codex’s Template Hierarchy. The short answer to your question is yes, you can run custom code on any page you’d like. The longer answer is still yes, but it’s a bit more involved in what your end product is … Read more
You can use wp_update_post() $my_post = array( ‘ID’ => $post_id, ‘post_author’ => $user_id, ); wp_update_post( $my_post ); Or change image’s author via a function using GravityForms uploader add_action(“gform_user_registered”, “image_author”, 10, 4); function image_author($user_id, $config, $entry, $user_pass) { $post_id = $entry[“post_id”]; $args = array( ‘post_parent’ => $post_id, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’ ); $attachments = … Read more
WordPress saves media library in the _posts table – you’ll see post_type of attachment for media library items. You’ll notice a guid value in the row, which is the media items default URL. While unlink()‘ing your file, you can make the file’s full URL. Then use that full URL in a simple database query ($wpdb) … Read more
For scripts you can use the script_loader_tag filter, which is run right before the script tag is output. It filters the HTML <script> tag, but it also passes the handle and URL that you can use to extract the contents and replace the script tag with a version that has the script inline: function wpse_292955_inline_script( … Read more
Correct solution provided by Milo in comment above. Pretty permalinks were set to plain in the admin interface and this evidently causes the WP_Rewrite to silently do nothing. I’m posting the answer here so I can mark something as correct/complete so this shows as answered. Am I doing it wrong?
the call at the anonymous function is done after all the executions of add_new_page. then you need to store all elements to create menu items. try to modify the class Helper like that public function __construct() // method to modify { add_action(“admin_menu”, [$this, “add_admin_menu_items”]); } public function add_new_page( $opt ) // method to modify { … Read more