WooCommerce settings API set checkbox checked by default [closed]

Using WooCommerce settings API to create some options on its settings page: https://docs.woocommerce.com/document/adding-a-section-to-a-settings-tab/

Everything works fine but unfortunately, I can’t seem to get checkboxes to be checked by default (before admin actually saves changes…aka on fresh install)

I know I can create the option in the DB on plugin install but I’m trying to just get the checkbox checked by default without creating options on plugin activation.

I’ve tried multiple options

            'name'     => __( 'Field Name', 'lpac' ),             'desc'     => __( 'Field description', 'lpac' ),             'id'       => 'field_id',             'type'     => 'checkbox',             'default' => true, // doesn't work             'css'      => 'min-width:300px;',         ); 

I’ve tried setting the default to different values like ‘checked’ and ‘on’ but still, the checkbox is not checked by default

Plugin to manage user permissions that saves settings to file instead of database [closed]

I want to manage user roles and permissions/capabilities through a plugin. Most plugins save their settings to the database. Since we’re running multiple environments with seperate databases, saving to the database is inconvenient. After every deploy we’d have to update the settings on the other environment.

What I’m looking for is a plugin which persists its settings to a file, much like ACF does with the acf-json folder. This way I don’t have to remember to update the settings after every deploy. Is there any plugin which does this?

I’m aware there are plugins with manual backup/restore functionality. While this does alleviate the problem, it’s not the solution I’m looking for

DNS Settings and the TXT record for authorizing email sending from the domain

Last night, I added a DNS record to my domain to allow Mailchimp to send emails as an official/authorized source.

enter image description here

It doesn’t seem to have totally worked, Mailchimp is sending emails but they are not being received – I believe this is because my SPF record is not properly authorizing Mailchimp’s servers to send on behalf of my domain.

I did a domain check at mxtoolbox and it’s showing "Multiple SPF Records Found":

enter image description here

Is it the ~all and -all that is causing an issue? It should be possible to have multiple TXT DNS records, right? Am I messing up the way I have added these TXT records?

I’d like to continue to be able to send email via Google/Gmail (this is working) but I also would like to authorize Mailchimp to send emails on behalf of my domain (hosted with GoDaddy)

Any suggestions for the setup I am trying to accomplish here? Thank you so much!

Remove “Default” from Gutenberg typography settings

I’ve added my own font sizes to the theme I’m working on, but the value "Default" persists in the dropdown. With the name scheme needed for this particular site I cannot just reformat "Default" to fit with my baseline typography. Can "Default" be removed somehow?

enter image description here


add_theme_support( 'editor-font-sizes', array(     array(         'name' => esc_attr__( 'Book 16px', 'wav' ),         'size' => 16,         'slug' => 'book16px'     ),     array(         'name' => esc_attr__( 'Book 20px', 'wav' ),         'size' => 20,         'slug' => 'book20px'     ),     array(         'name' => esc_attr__( 'Book 24px', 'wav' ),         'size' => 24,         'slug' => 'book24px'     ),     array(         'name' => esc_attr__( 'Book 32px', 'wav' ),         'size' => 32,         'slug' => 'book32px'     ),     array(         'name' => esc_attr__( 'Book 36px', 'wav' ),         'size' => 36,         'slug' => 'book36px'     ),     array(         'name' => esc_attr__( 'Book 48px', 'wav' ),         'size' => 48,         'slug' => 'book48px'     ),     array(         'name' => esc_attr__( 'Book 64px', 'wav' ),         'size' => 64,         'slug' => 'book64px'     ),     array(         'name' => esc_attr__( 'Book 96px', 'wav' ),         'size' => 96,         'slug' => 'book96px'     ),     array(         'name' => esc_attr__( 'Book 144px', 'wav' ),         'size' => 144,         'slug' => 'book144px'     ), )); 

Content-Security-Policy Headers are there and showing the correct settings, but still getting a refused connection

So I’m putting a plugin together that will allow me to connect multiple client sites with an online service.

I can get the service vendors snippet to load, but once you interact with it, that’s where things get tricky and it refuses to load an (I guess) iframe… …it’s pretty poorly documented.

Refused to load https://www.service-domain.com/ because it does not appear in the frame-ancestors directive of the Content Security Policy.

That’s the console log error I was receiving.

So I jumped back into my plugin and added the following:

function bbti_send_headers() {     header( "Content-Security-Policy: frame-ancestors https://www.service-domain.com/; frame-src https://www.service-domain.com/;" ); } add_action( 'send_headers', 'bbti_send_headers' ); 

Now, when I reload the page I’m still getting the same error Refused to load https://www.service-domain.com/... etc...

However, if I look at the network panel and check the page’s headers this is what I get:

HTTP/1.1 200 OK Content-Encoding: gzip Content-Security-Policy: frame-ancestors https://www.service-domain.com/; frame-src https://www.service-domain.com/; 

So the header is there but still getting the same error from the script.

Anyone know what it is I missed?

Possibility of adding meta description to harvester engine settings ?


i have a new question. 

Is it possible to use the “Aditional header / settings”  optin in the harvester setitngs to also grab meta description/ or meta title  when harvesting urls?

And can i display it (the description) in the main window?

Why –  in my experience it is MUCH easier to understand if a site is or is not relevant from URL AND meta description than from just url alone.
so, its way faster to filter out bad results.


Help with NIntegrate settings to evaluate integral

I am trying to evaluate this integral: \begin{align*} \alpha_{2}=\int_{-\infty}^{1.645}\left[1-\Phi\left(\frac{\sqrt{25}}{\sqrt{15}} 1.645-\frac{\sqrt{10}}{\sqrt{15}} z_{1}\right)\right] \phi\left(z_{1}\right) d z_{1} \end{align*} where $ \Phi$ is the Normal CDF and $ \phi$ is the normal PDF. I know that the answer should be 0.03325.

I used the following code, but it doesn’t converge to an answer. Any suggestions?

pdf[x_] := PDF[NormalDistribution[0, 1], x]  cdf[x_] := CDF[NormalDistribution[0, 1], x]  NIntegrate[ 1 - cdf[Sqrt[25]/Sqrt[15] 1.645 - Sqrt[10]/Sqrt[15] x]* pdf[x], {x, -Infinity, 1.645}]  

which returns

NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.  NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in x near {x} = {-8.16907*10^224}. NIntegrate obtained 8.582639123060543`15.954589770191005*^27949 and 8.582639123060543`15.954589770191005*^27949 for the integral and error estimates. 

The following code in R gives me the correct answer:

inside <- function(z1, n1, n2, cv) {   nt <- n1 + n2   (1 - pnorm(sqrt(nt/n2) * cv - sqrt(n1/n2) * z1)) * dnorm(z1) }  additional.error <- function(n1, n2, cv) {   integrate(inside, lower = -Inf, upper = cv, n1 = n1, n2 = n2, cv = 1.645)$  value }  additional.error(n1 = 10, n2 = 15, cv = qnorm(0.95)) ```