Return $post_id when DOING_AUTOSAVE?

The ‘save_post’ action was added to core in 2.0, and has always been an action. Looking through the current autosave procedures, it doesn’t appear to call the ‘save_post’ action directly at any time. So the short answer is, no. There is no reason, and has never been any reason, to return any value on this … Read more

Shared functionality in plugins and themes

Actions & Filters The imho best way is to use an action to bring plugin functions into themes. Example #1 Here’s a little plugin to test this. <?php /** Plugin Name: (#68117) Print Hello! */ function wpse68117_print_hello() { echo “Hello World!”; } add_action( ‘wpse68117_say’, ‘wpse68117_print_hello’ ); Inside the theme: <?php /** Template Name: Test »Print … Read more

Display random categories on the front page (Finding and Editing Theme Functions)

The real question here is: How do I find “TheirCode” which is responsible for this selection using tools such as firefox dev bar and the actual source? If you are referring to the HTML output/source, then for example on the official Storefront theme demo site, just right-click on the “Product Categories” heading or section and … Read more

How to use PanelColorSettings in custom Gutenberg block?

First you need to import the component – const { PanelColorSettings, } = wp.editor; then inside the InspectorControls you call the component <PanelColorSettings title={ __( ‘Color Settings’ ) } colorSettings={ [ { value: color, onChange: ( colorValue ) => setAttributes( { color: colorValue } ), label: __( ‘Background Color’ ), }, { value: textColor, onChange: … Read more

Make Custom Metaboxes Collapse by Default

To display a metabox collapsed or closed by default, it is good to know that adding closed to it’s class attribute will display it closed. All meta-boxes main divs that have closed in their classname, are displayed in the closed form. When the arrow is clicked it will be removed or added (toggled). This is … Read more

How to Change 404 page title

I would use the wp_title filter hook: function theme_slug_filter_wp_title( $title ) { if ( is_404() ) { $title=”ADD 404 TITLE TEXT HERE”; } // You can do other filtering here, or // just return $title return $title; } // Hook into wp_title filter hook add_filter( ‘wp_title’, ‘theme_slug_filter_wp_title’ ); This will play nicely with other Plugins … Read more

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