How to track clicks

Unless you have a “religious” objection to share data with google then using GA is just the simplest and best way to go. Storing stats in your DB is a good start if you want to bring your server down when there is slightly high traffic, and in any case you can get all the … Read more

override filter in a plugin

My mistake was that I was trying to remove the plugin’s filter from within my own plugin. In order to modify a plugin’s filter, the remove_filter() function must be in the child theme’s functions.php file.

Add back to post link on blank comment post error page

I think ‘pre_comment_on_post’ is a better hook to use, although you’ll have to reproduce some logic from “wp-comments-post.php” to use it, eg: add_action( ‘pre_comment_on_post’, function ( $comment_post_ID ) { $go_back = sprintf( __( ‘<br><a href=”https://wordpress.stackexchange.com/questions/207612/javascript:history.go(-1)”>Back to “%s” Article</a>’ ), get_the_title( $comment_post_ID ) ); // Part-copied from “wp-comments-post.php”, with $go_back tagged onto error strings. $comment_author = … Read more

Issues with a WP plugin menu system

This function is still open! Add “}” at the end. function register_submenu_page() { add_submenu_page( ‘broughton-admin-page’, ‘Upload XML’, ‘Upload XML’, ‘manage_options’, ‘upload-xml-page’, ‘upload_xml_page’ ); add_submenu_page( ‘broughton-admin-page’, ‘Archive XML’, ‘Archive XML’, ‘manage_options’, ‘archive-xml-page’, ‘archive_xml_page’ ); }

plugin shortcode not working on ajax request call

…ajax calls can’t show shortcodes because of the admin ajax url that they dont have full access to wordpress enviorment Not true. AJAX calls have exactly the same resources at their disposal as regular WordPress requests. Just make sure to parse the content in the same way the_content() does: $parsed_content = apply_filters( ‘the_content’, $post->post_content ); … Read more