Accessing an image folder inside public web directory

For directory (folder), only read is not enough. You need to set execute also. Because for directory, execute means you can enter the directory. Files need read permission & directory needs read & execute permission. So the directory permission should be: 0555. However, image files inside that directory should be just read, in numeric form: … Read more

Modify function to print tags/categories/exclude tags/categories/ number of posts

I wonder if you mean this kind of a loop wrapper: wpse_257857_loop( $args = [ ‘post_type’ => ‘page’, ‘posts_per_page’ => 2 ], $before=”template-parts/wpse-before”, $loop = ‘template-parts/wpse-loop’, $after=”template-parts/wpse-after” ); where we define it in the functions.php file, in the current theme directory: /** * Simple loop wrapper */ function wpse_257857_loop( $args, $before, $loop, $after ) { … Read more

Refresh table data with Ajax

In wordpress you need to use ajax in a specific way to follow the standard https://codex.wordpress.org/Plugin_API/Action_Reference/wp_ajax_(action) create a function in your functions.php file to handle the data retrieval and/or display of the table and add a hook to wp_ajax_(fires only for logged in users) and wp_ajax_nopriv_(fires for guests as well) add_action( ‘wp_ajax_add_foobar’, ‘prefix_ajax_add_foobar’ ); add_action( … Read more

Extend PHP regex to cover “srcset” and “style” attributes

I was able to use the following regex to cover all tags & attributes with protocols: /<(?:input\b[^<]*\bvalue=[\”\’]https?:\/\/|link\b[^<]*?\brel=[\’\”]canonical[\’\”][^<]*?>)(*SKIP)(*F)|https?:\/\// This is the updated section: # If ‘Relative’ option is selected, remove domain from all internal links $exceptions=”<(?:input\b[^<]*\bvalue=[\”\”]https?:\/\/|link\b[^<]*?\brel=[\’\”]canonical[\’\”][^<]*?>)(*SKIP)(*F)’; if ( $this->option == 2 ) { $website = preg_replace( ‘/https?:\/\//’, ”, home_url() ); $links = preg_replace( “https://wordpress.stackexchange.com/” . $exceptions … Read more