Hot answers tagged

1

You can't enqueue because wp_loaded is too early. To enqueue scripts and styles, you need to do it on the wp_enqueue_scripts type hooks, but because your exiting on wp_loaded, none of those hooks have fired yet. Additionally, you need to have the necessary function calls in the template for it to enqueue them into, such as wp_head or wp_footer, otherwise ...


1

Unfortunately there doesn't seem to be any action hooks available for adding custom checkboxes to the Menu Settings section (Github/wp-admin/nav-menus.php). For registering menu locations, you should use register_nav_menus().


1

You can't just filter __FILE__. Or any arbitrary function or variable. You can only filter values that are passed to apply_filters(). In this case the wcpv_vendor_order_page_template filterable value is: dirname( __FILE__ ) . '/views/html-vendor-order-page.php' In other words, it's a path to a PHP file. If you want to change the PHP file that's loaded, you ...


1

You can use this filter, function ar_lazyload_deactivate() { if ( is_singular( 'posttype name' ) ) { add_filter( 'do_rocket_lazyload', '__return_false' ); } } add_filter( 'wp', __NAMESPACE__ . '\ar_lazyload_deactivate' );


1

save_post and new_to_publish is enough, with some checks, to update post metadata. And you don't need the redirection. <?php /** * Update Postmeta. * * @param integer $post_id Post ID. */ function wpse355298_job_publish_status( $post_id ) { // Check autosave. if ( wp_is_post_autosave( $post_id ) ) { return $post_id; } // ...


1

Answer by @Pieter Goosen : If you need to update the page before the main query fires and returns the page object, you will manually need to parse the URL (probably on init) and get the page ID from get_page_by_title() or get_page_by_path(). Otherwise, 'wp' would be earliest hook to get the page ID, for example: function my_early_id() { $...


Only top voted, non community-wiki answers of a minimum length are eligible