Articles of hooks

Action hook save_post for newly created posts – $post object data is all empty

When a post is created, I need to auto-generate a PDF version of the post. The problem is that the global $post object is mostly empty except for the post ID. I need to get the newly created post’s slug because the name of the PDF file needs to match the slug of the page. […]

Configure WordPress to Generate Scheme-less Relative URLs

I have a WordPress site where the CSS and Javascript URLs/tags end up looking like this <link rel=’stylesheet’ id=’dashicons-css’ href=’http://example.com/wp-includes/css/dashicons.min.css?ver=4.7.8′ type=’text/css’ media=’all’ /> <script type=’text/javascript’ src=’http://example.com/wp-includes/js/jquery/jquery.js?ver=1.12.4′></script> Is it possible to configure WordPress to use scheme-less relative URLs? i.e to generate links that look like this? <link rel=’stylesheet’ id=’dashicons-css’ href=’//example.com/wp-includes/css/dashicons.min.css?ver=4.7.8′ type=’text/css’ media=’all’ /> <script type=’text/javascript’ src=’//example.com/wp-includes/js/jquery/jquery.js?ver=1.12.4′></script> […]

Are there action hooks for comments?

This is for a personal-use plugin I’m trying to make. I want to submit a comment from site A to my blog (sort of like sending trackbacks/pingbacks but a full comment). For instance, on site A I have a form with a name, url, and comment field. The data I enter in site A, I […]

INSERT in table row fatal error

I just discovered this wonderful message board 🙂 Hopefully someone can help me with a WordPress issue I can’t figure out.. I added a hook to my plugin file to insert the post id of the immediate posts I publish, in a table named “post_votes” – used to keep track of up & down votes […]

Hide one specific woocoomerce product

I would like to hide one specific product for all not logged in users. Suppose $post is that post. I used the hooks: add_action( ‘wp’, ‘WC_Query::remove_product_query’ ) ; and remove_action( ‘pre_get_posts’, ‘WC_Query::pre_get_posts’ ); but none of them seem to be working. global $post; if( get_post_type() == “product” ) { if(is_user_logged_in()){ return; } add_action( ‘wp’, ‘WC_Query::remove_product_query’ […]

Display Plugin Panels Outside of Admin Areas

I’m trying to find a way to display the work area content of different plugins on pages/posts/areas aside from the admin backend. For example, how would I display the options panel for a certain plugin in a page instead of it’s default location? If the plugin also has an output view, like Google Analytics dashboard, […]

Help me to understand wp_header() and wp_footer() functions

hi everyone please help me to understand the hook functions wp_header() and wp_footer() What does it mean hook functions and what to do

Defining hooks within (php)classes?

I have been trying to write a reusable modular options class and I am stuck at this specific point. How do i define hooks within php classes? Try 1 : class super_options { // …………………….. function render_options_page () { //……………….. $this->top_page_hook(); //……………….. } // …………………….. function top_page_hook() { do_action( array( &$this, ‘top_page_hook’) ); } } […]

run script on publish

I am trying to run a script when a user publishes / updates a post. I am using the filter: wp_insert_post_data The problem I am having is the script is a php file outside of WordPress but on the same site (It works fine if i go direct to it) that just needs to be […]

Prepending character(s) to a custom <!–more–> tag title?

I’m hacking around with a blog using Cordobo Green Park and I’ve noticed when I specify a custom title, instead of it beginning with a » symbol (as it does for the standard “» Read more: [POSTTITLE]“) the custom message is simply shown without any prepended character. It’s a shame, because the » character would […]