Customise Jetpack Publicize text

Just some general remarks: Why isn’t the following change working? $custom_message = get_the_title( $post->ID ) .”. $hash_tags; to: $custom_message = get_the_content( $post->ID ) .’ ‘. $hash_tags; Note that get_the_content() doesn’t take a post ID as an input parameter and it depends on global variables, like $pages that’s derived from $post->post_content (with some pagination adjustments), within … Read more

Using custom fields in a filter hook

Try get_queried_object() to reference the WP_Post that created the page. if you’re on a single post, it will return the post object if you’re on a page, it will return the page object if you’re on an archive page, it will return the post type object if you’re on a category archive, it will return … Read more

How can I reliably and globally disable wptexturize?

Plugins will be able to re-enable any filter you have switched off, if they do so after you are finished. So the trick is to make sure you are the last one to do something with this filter by setting a high number, low priority on it. add_filter( ‘run_wptexturize’, ‘__return_false’, 9999 );

Help with callback using do_action_ref_array

That feature exists because I bugged them to implement it 🙂 https://support.booking-wp-plugin.com/hc/en-us/community/posts/207263389-Add-a-WordPress-hook-for-custom-validators-on-the-custom-fields?page=1#community_comment_115001021885 Using it confused me as well but somebody finally replied to this just the other day with this snippet: add_action( ‘bookly_validate_custom_field’, function ( \stdClass $field, &$errors, $cart_key, \stdClass $field_info ) { // Validation by custom_field id switch ( $field->id ) { case ‘id_value’: … Read more

Filter post before *editing*

You can use the the_editor_content filter: function wpa_editor_content( $content ) { global $post; return “this post’s id is $post->ID ” . $content; } add_filter( ‘the_editor_content’, ‘wpa_editor_content’ );

WordPress Register Style Called Incorrectly

The notice is quite obvious. It is telling you that you are not running wp_register_style() within the wp_enqueue_scripts hook. SOLUTION Move your wp_register_script() and wp_register_style() calls to inside your function which is hooked to wp_enqueue_scripts

Custom form action hook

admin_url( ‘admin-post.php’ ) is the non-ajax version of admin_url( ‘admin-ajax.php’ ) Similar to admin-ajax.php it will fire one of four hooks: Logged out users admin_post_nopriv_{action} ($_REQUEST[‘action’] specified) admin_post_nopriv (no $_REQUEST[‘action’] specified) Logged in user admin_post_{action} ($_REQUEST[‘action’] specified) admin_post (no $_REQUEST[‘action’] specified) The ‘action’ can therefer bespecified as part of the target url (e.g. admin_url( ‘admin-ajax.php?action=my-action’ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)