Trying to add_action in a loop

As Milo hints at in their comment, custom post types can only be registered on the init hook. Therefore, if you are trying to get all the public but not builtin post types before init, then get_post_types() will return an empty array. (You can use get_post_types() to get the builtin post types before init.) What …

Read more

Get param from shortcode in plugin function

If you have this shortcode: [product id=”2″] Which is redered by this: add_shortcode( ‘product’, ‘getSingleProduct’ ); function getSingleProduct( $atts ) { shortcode_atts( [ ‘id’ => ‘0’, ], $atts ); // Do someting with the “2”. do_request( ‘GET’, get_api_url() . ‘api/product/’ . “2” ); // This “2” comes from the shortcode } You can get the …

Read more

Woocommerce – WordPress Roles & Capabilities

Using the Access plugin, you can create more fined grained access control and achieve better administration of your site. Use the following steps to create your own roles with custom permissions for Woo-commerce. 1. Create a custom role. 2. Click on Change permissions for that role, click on Woo-commerce capabilities to display related ones and …

Read more

Print posts category or tag as a formatted journal

You don’t have to use a specific plugin to achieve columns in print, you can modify how your layout looks when printing using the print CSS media query. You can learn more about this topic here. In case of the WP Journal plugin to print 3 columns of text add this: @media print { .cols3 …

Read more

check uncategorized category by default

It doesn’t need to be checked to work. When you publish the post, as long as you haven’t added another category and explicitly checked it, WordPress will automatically assign the Uncategorized category for you. Once you hit publish and the page refreshes you’ll see the checkbox checked.